dbradbury Posted January 13, 2010 Share Posted January 13, 2010 is it possible to do a mysql query then, do a mysql query on the results of the first one? if so how would it be done? Link to comment https://forums.phpfreaks.com/topic/188339-is-this-possible/ Share on other sites More sharing options...
aeroswat Posted January 13, 2010 Share Posted January 13, 2010 is it possible to do a mysql query then, do a mysql query on the results of the first one? if so how would it be done? Why do you need to do this? Why not just add multiple conditions to the WHERE statement? What are you trying to accomplish exactly? Link to comment https://forums.phpfreaks.com/topic/188339-is-this-possible/#findComment-994262 Share on other sites More sharing options...
JonnoTheDev Posted January 13, 2010 Share Posted January 13, 2010 Of course it is possible however it is probable that your results can be achieved with a single query. Link to comment https://forums.phpfreaks.com/topic/188339-is-this-possible/#findComment-994265 Share on other sites More sharing options...
dbradbury Posted January 13, 2010 Author Share Posted January 13, 2010 thanks all.. <?php include("connect.php"); require("bbcode.php"); $getinfo = mysql_query("SELECT * FROM phpbb_posts WHERE forum_id='14'"); $row = mysql_fetch_assoc($getinfo); echo nl2br(bbcode($row['post_text'])); ?> <table width="776" border="0"> <tr> <td colspan="2"> <?php $getdetails = mysql_query("SELECT * FROM $getinfo WHERE post_subject='Details'"); $row1 = mysql_fetch_assoc($getdetails); echo nl2br(bbcode($row1['post_text'])); ?> </td> </tr> <tr> <td width="383"> </td> <td width="383"> </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table> well i think i need to do it via separate queries, as i need to get all the stuff from a forum.. then display a certain post in a certain table cell.. that was my attempt but it didnt like the $getinfo in the mysql query part lol.. obv lol Link to comment https://forums.phpfreaks.com/topic/188339-is-this-possible/#findComment-994267 Share on other sites More sharing options...
JonnoTheDev Posted January 13, 2010 Share Posted January 13, 2010 $getinfo is the result of a mysql_query() function call, not a string. You are using it as a string in the following code. $getdetails = mysql_query("SELECT * FROM $getinfo WHERE post_subject='Details'"); There should be the name of a table in its place $getdetails = mysql_query("SELECT * FROM tablename WHERE post_subject='Details'"); Link to comment https://forums.phpfreaks.com/topic/188339-is-this-possible/#findComment-994269 Share on other sites More sharing options...
aeroswat Posted January 13, 2010 Share Posted January 13, 2010 SELECT * FROM phpbb_posts WHERE forum_id='14' AND post_subject='Details' Link to comment https://forums.phpfreaks.com/topic/188339-is-this-possible/#findComment-994270 Share on other sites More sharing options...
dbradbury Posted January 13, 2010 Author Share Posted January 13, 2010 thanks, the AND worked.. Link to comment https://forums.phpfreaks.com/topic/188339-is-this-possible/#findComment-994278 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.