Glenskie Posted August 1, 2012 Share Posted August 1, 2012 ok i need to grab things from two tables in my database , here is my code that i was using , but i changed my friend table so i need to change my code ! here is what i had ... i dont need m.friend_array anymore , the table is friends and the rows in the table are id , mem_1 , mem_2 , and Date... thank you so much!!!! <?php $query = mysql_query("SELECT p.id, p.to_id, p.from_id, p.post, p.type, p.state, p.date, m.friend_array FROM myMembers AS m LEFT JOIN posts AS p ON p.to_id = m.id WHERE p.state = '0' AND m.id = '" . $logOptions_id . "'" ); if(mysql_num_rows($query)==0) { ?> <div class="no-info">There are no posts! or you have no friends!</div> <?php } else { posts($query); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/266536-how-to-grab-things-from-2-tables-in-a-database/ Share on other sites More sharing options...
mikosiko Posted August 1, 2012 Share Posted August 1, 2012 I don't see a problem here... you just posted an example of using a SELECT with a JOIN between 2 tables... just follow your own code as an example and try to modify it according to what you want now Quote Link to comment https://forums.phpfreaks.com/topic/266536-how-to-grab-things-from-2-tables-in-a-database/#findComment-1365947 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.