pdo fetch within a fetch error

dasdasdas

New Member
I am trying to run the following script (unsuccessfully):\[code\]$variables = $db->query("SELECT * FROM table1 WHERE Session_ID = '$sess1'");while($row = $variables->fetch()) {//FETCH DATA$id= $row["ID"];$info = $db->query("SELECT * FROM table2 WHERE ID = $id");while($row2 = $info->fetch()) { $name = $row2["FNAME"]." ".$row2["LNAME"]; } $phone = $row2["PHONE"];}//SEND CUSTOMER EMAILrequire("../email/email.php"); }\[/code\]this returns the error: Fatal error: Call to a member function fetch() on a non-object in...While I am able to "solve" the problem, it is ugly. Essentially I have to make several calls ahead of the one I'm trying below (which in theory should work). Any ideas?
 
Back
Top