2012-04-29 22 views
0

が、私はこのエラーを取得中: 不明な列 'examinfo.id_examinfo' where句不明な列 'examinfo.id_examinfo' 'WHERE句'

私のクエリは

$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); 
+7

こんにちはSQLインジェクションでなければなりません。 – sevenseacat

答えて

2

逆引用符は、テーブル名またはフィールド名を区切るために使用します。これは不正な構文です:

`examinfo.id_examinfo`. 

このような列を持たないため、examinfo.id_examinfoです。

`examinfo`.`id_examinfo` 

または単に

examinfo.id_examinfo 
0

親愛なるこのエラーショーは」であなたの与えている列の名前が特定のテーブルにexeistしていないので、列の名前を確認してください。