angel1987 Posted June 27, 2010 Share Posted June 27, 2010 Hi, i need some help please... Tablename : userdetails ID username password emailid 1 abc xyz [email protected] Tablename: articles ID title content submittedby 1 hello world some content 1 Now i have the title of an article which is "hello world" and from this title i want to find an emailid of the user who submitted that article. I think it can be done through JOIN thing but since i am learning i am stuck on it, so please help me. Link to comment https://forums.phpfreaks.com/topic/205978-please-help-with-join-query-usage/ Share on other sites More sharing options...
Mchl Posted June 27, 2010 Share Posted June 27, 2010 SELECT u.emailid FROM users AS u INNER JOIN articles AS a ON a.submittedby = u.ID WHERE a.title = ? Link to comment https://forums.phpfreaks.com/topic/205978-please-help-with-join-query-usage/#findComment-1077803 Share on other sites More sharing options...
angel1987 Posted June 27, 2010 Author Share Posted June 27, 2010 Ok thanks but how do i display the result for this? It gives an error while displaying the value after processing the query and through the while loop. Link to comment https://forums.phpfreaks.com/topic/205978-please-help-with-join-query-usage/#findComment-1077820 Share on other sites More sharing options...
Mchl Posted June 27, 2010 Share Posted June 27, 2010 What code you use for this and what error is displayed? Link to comment https://forums.phpfreaks.com/topic/205978-please-help-with-join-query-usage/#findComment-1077822 Share on other sites More sharing options...
angel1987 Posted June 27, 2010 Author Share Posted June 27, 2010 It gave an unknown column error but i figured it out and its working now, thanks very much for your help. Link to comment https://forums.phpfreaks.com/topic/205978-please-help-with-join-query-usage/#findComment-1077825 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.