我需要运行一个从多个表中选择记录的 mysql 查询。表的名称通过邮寄接收并存储在数组中。我所做的是这不起作用:
//--> Check if anything is posted from the client
if(isset($_POST['code'])){
$emps = array();
foreach(($_POST['code']) as $c) {
$emps[] = $c;
}
@$res = mysql_query("select code,fname,faname from (".implode(',',$emps).")") where emp_code='11330' ;
while($r = mysql_fetch_array($res)){
//do something...
}
}