我收到此错误:'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);