Hi All, I get this warning (Invalid argument supplied for foreach()). Following is my code: foreach (sql_get('vms_enrollments', 'student_id', $_SESSION['id']) as $k1 => $v1) { $db = new DbConn(); [b] foreach (sql_get('vms_tests', 'tr_mod_id', $v1['tr_mod_id']) as $k2 => $v2) <-- this line triggers the error [/b] { $sql = "select count(*) ". " from vms_test_results". " where test_id = ".$v2['test_id']. " and student_id = ".$_SESSION['id']; $res = $db->query($sql) or die('Could not execute:<br /><br />'.$sql); $row = mysql_fetch_row($res); if ($row[0] <= 0) $tests[] = $v2; } } If I change $v1['tr_mod_id'] to a number. Then no warning is issued. I'm really confused. Is this PHP bug?