Hi
Im trying to loop through a query and on each loop run a seperate query.
Here's my loop:
while ($row = $db->fetchObject()){
// My query here
}
Here's my loop with the query:
while ($row = $db->fetchObject()){
$qry = "SELECT * FROM `tablename` WHERE row= '".$row->id."'";
$db->query($qry);
}
The problem is when i loop through $row->id loses its value after the first loop causing the other querys below it to break.
Does anyone know why this would happen?
Here's my function within the class if this helps:
function query($qry) {
$this->obj = @mysql_query($qry);
if (!$this->obj){
print '<strong>Query failed:</strong><br />'.$qry;
print '<br /><br /><strong>MySQL error:</strong><br />'.mysql_error();
exit;
}
return $this->obj;
}