Here is my problem, i have two tables, in one are conections (one column – team id, other – persons id) i find all the persons id’s from an exact team (here it is ‘t1’) and put it into an array, everything is ok here.
$id1 = mysql_query("SELECT id FROM connections WHERE team='t1'");
$id11 = array();
while(($row = mysql_fetch_assoc($id1))) {
$id11[] = $row;
}
echo "";
print_r($id11);
echo "";
until here everything is ok, in print_r i see items of an array, that i want to see. But from here [fecal matter] happens. I vant to select person names from ‘persons’ table, that has id’s from previous array ($id11). at the end i get an empty array.
$kom1 = mysql_query("SELECT name FROM persons WHERE s_id IN('".join("','", $id11)."')");
//$kom1 = mysql_query("SELECT name FROM persons WHERE s_id IN(".implode(',',$id11).')'); //this one doesnt work too
$kom11 = array();
while(($row1 = mysql_fetch_assoc($kom1))) {
$kom11[] = $row1;
}
echo "";
print_r($kom11);
echo "";
Tried everything, please help me,thank you.
Use subquery directly in second query :
Should be working in every not so fancy DB