ljmyers Posted February 19, 2009 Share Posted February 19, 2009 My apologies if the answer to this is here somewhere. I have searched for days and tried writing it 500 different ways trying to figure this out but cannot get it to work just as i want it. I have two tables, prefix_users and prefix_recipes. I need for the statement to look at and compare the id (user's id) from table prefix_users with the user_id and id (recipe's id) from the table prefix_recipes and if they are the same, show the recipe's name on the page. It is the user's profile page that I am trying to include the recipes that the user has submitted on their specific page. Any help would be great. table: prefix_users id (user's id) table: prefix_recipes id (recipe's id) user_id name (recipe's name) Smiles, Lana Link to comment https://forums.phpfreaks.com/topic/145909-select-statement-two-tables/ Share on other sites More sharing options...
Mchl Posted February 19, 2009 Share Posted February 19, 2009 SELECT * FROM prefix_users AS u INNER JOIN prefix_recipes AS r ON (u.id = r.user_id) WHERE u.id = ? Link to comment https://forums.phpfreaks.com/topic/145909-select-statement-two-tables/#findComment-766074 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.