microsocket Posted November 3, 2012 Share Posted November 3, 2012 Afternoon, wondering if anyone can help me solve this. I need to loop inside a loop and create an output from this below... $result = $DBO->query("SELECT * FROM `stocks` ORDER BY `id` ASC"); while($line = $DBO->fetch_array($result, MYSQL_ASSOC)) { $id = $line['id']; $resulta = $DBO->query("SELECT * FROM `shares` WHERE `userid`='".$User->id."' AND `companyid`='".$id."'"); while($linea = $DBO->fetch_array($resulta, MYSQL_ASSOC)) { $fluc = $linea['cost']; } } the first part needs to select all the id's from one table The second part needs to then select a field 'cost' from another table that matches the user id and the stock id (pulled from first table) if that makes sense. Anyone care to point me in the right direction please ? Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.