Consider this (simplified) code... Function getLevelOne is called, runs fine, calls getLevelTwo, runs fine, and then stops, without continuing the while that was called in getLevelOne... The way its written, you'd assume that the second function would be called for each number in $list1 (2,4,5,6)... Am I missing something?
$list1 = "2,4,5,6";
$table1 = 'thistable';
getLevelOne($list1, $table1);
function getLevelOne($list1, $table1){
$q = "select * from $table1 where id IN ('$list1')";
$r = mysqli_query($db, $q);
while($row = mysqli_fetch_array($r)){
echo 'oh';
$table2 = 'nexttable';
$list2 = $row[$table2];
getLevelTwo($list2, $table2);
}
}
function getLevelTwo($list2, $table2){
$q2 = "select * from $table2 where id IN ('$list2')";
$r2 = mysqli_query($db, $q2);
while($row2 = mysqli_fetch_array($r2)){
echo 'shit';
}
}