0

我收到此错误:'where 子句中的未知列'examinfo.id_examinfo'

我的查询是

$examinf = $_GET['info'];
$sec = $_GET['sec'];
$sp = $_GET['sp'];
$datefrom= $_GET['datefrom'];
$dateto= $_GET['dateto'];
$where[] = "1=1";
if($examinf!='') $where[] = "`examinfo.id_examinfo`=`exams.id_examinfo` AND
`exams.id_examinfo` = '$examinf'";
if($sec!='') $where[] = "`secretary.id_sec`=`exams.id_sec` AND `exams.id_sec` = '$sec'";
if($sp!='') $where[] = "`specialties.id_sp`=`exams.id_sp`  AND `exams.id_sp` = '$sp'";
if($datefrom) $where[] = "`exams.date_exams` >= '$datefrom'";
if($dateto) $where[] = "`exams.date_exams` <= '$dateto'";
$where = @JOIN(" AND ", $where);
mysql_select_db($database_trainingdb, $trainingdb);
$query_Recordset_res = "SELECT secretary.name_sec, specialties.ar_sp, examinfo.name_examinfo,
exams.date_exams FROM exams, secretary, specialties, examinfo WHERE $where";
$Recordset_res = mysql_query($query_Recordset_res, $trainingdb) or die(mysql_error());
$row_Recordset_res = mysql_fetch_assoc($Recordset_res);
$totalRows_Recordset_res = mysql_num_rows($Recordset_res);
4

2 回答 2

2

反引号用于分隔表或字段名称。所以这是不正确的语法:

`examinfo.id_examinfo`. 

因为你没有这样的专栏examinfo.id_examinfo。应该

`examinfo`.`id_examinfo` 

或者干脆

examinfo.id_examinfo
于 2012-04-29T06:32:21.923 回答
0

亲爱的这个错误表明你给的列名在特定的表中不存在,所以请检查你的列名。

于 2012-04-29T06:29:47.763 回答