当我选择一个选项时,我用onchange函数调用Javascript代码。我发送了两个参数:
//capaciteit.php
function testfunction(week, id)
{
window.location.href = "capaciteitberekening.php?week=" + week + "&id=" + id;
}我调用文件capaciteitberekening.php并使用它发送参数。然后,我尝试使用$_GET函数获得这两个参数:
//capaciteitberekening.php
require ('capaciteit.php');
$id = $_GET['id'];
$week = $_GET['week'];
echo $id, $week;在我回显$id和$week(检查它们是否工作)之后,我调用一个查询:
//capaciteitberekening.php
$datumbegin = mysql_query("SELECT * FROM capaciteit");
while($row = mysql_fetch_array($datumbegin))
{
echo $row['DAGEN'];
}当我在我的网站上尝试这一点时,它只显示了$id和$week的回声。
这段代码是可以工作的,因为我在其他地方使用它,它在那里工作得很好。
这就是我连接到DB的方式:
require('auth.php');require_once('config.php');require_once('exec/pubs_exec.php');
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); //Database openen
if(!$link) die('Niet gelukt om verbinding te maken met de server: ' . mysql_error());
$db = mysql_select_db(DB_DATABASE); //Select database
if(!$db) die("Selecteren van DB mislukt");在config.php中,我为DB_host、DB_USER、DB_PASSWORD和DB_DATABASE设置了值
我在这里做错什么了?
https://stackoverflow.com/questions/26218130
复制相似问题