我正在尝试从dete表中选择名字和父亲名字,其中cidc列等于cidcm表中的cidc列。但在phpmyadmin sql查询中显示为“#1052-where子句中歧义的列'userID'”,并在系统界面中隐藏了CSS。
public static function display($detid,$limit, $db){
if($limit=='100'){
$userID =$_SESSION['userID'];
$sql= "SELECT det.* FROM cidcm, dete WHERE cidcm.cidc=dete.cidc AND
userID='$userID'";
}
$output = array();
$query = mysql_query($sql) or die(mysql_error());
if( $query ){
if( mysql_num_rows( $query) > 0){
while( $row = mysql_fetch_object( $query )){
$output[] = $row;
}
}else{
echo "no rows found";
}
return $output;
}
return null;
}
And the display code is the following:
<?php
$limit = '100';
$Return = Dete::display($detid, $limit,$db);
foreach($Return as $key => $Return):
echo "<option value='".$Return->detid."'>".$Return->firstName."
".$Return->fatherName."</option>";
endforeach;
?>
我期望的结果是det表中所有名字的父亲,并且其cidc列等于cidcm表cidc cokumn中的父亲。