I need to run a mysql query that selects records from several tables. the names of the tables are received via post and are stored in an array. What I have done is this that does not work:
//--> 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...
}
}