vicdesigns Posted June 30, 2011 Share Posted June 30, 2011 Howdy. I have the following, where I want to display data from posts and settings on the same php page. // Get the data $result = mysql_query ("SELECT * FROM posts, settings"); The above seems to work fine. However, if I add the users table as below, it turns the site into a blank white page: // Get the data $result = mysql_query ("SELECT * FROM posts, settings, users"); Can anyone shed some light on this? Quote Link to comment https://forums.phpfreaks.com/topic/240776-selecting-more-than-two-tables-to-display-on-same-page/ Share on other sites More sharing options...
Pikachu2000 Posted June 30, 2011 Share Posted June 30, 2011 Do you have error reporting enabled? Is there anything at all in the html source of the page when you get the blank screen? Quote Link to comment https://forums.phpfreaks.com/topic/240776-selecting-more-than-two-tables-to-display-on-same-page/#findComment-1236687 Share on other sites More sharing options...
vicdesigns Posted June 30, 2011 Author Share Posted June 30, 2011 Very strange. The page is blank and all that's in the source is: </html> Quote Link to comment https://forums.phpfreaks.com/topic/240776-selecting-more-than-two-tables-to-display-on-same-page/#findComment-1236688 Share on other sites More sharing options...
PFMaBiSmAd Posted June 30, 2011 Share Posted June 30, 2011 Also, what relationship exists between the data in these three tables? If there is no relationship between the data in the three tables, you should not have them in the same query because the result you get is not what you think it is. Quote Link to comment https://forums.phpfreaks.com/topic/240776-selecting-more-than-two-tables-to-display-on-same-page/#findComment-1236690 Share on other sites More sharing options...
vicdesigns Posted June 30, 2011 Author Share Posted June 30, 2011 Cheers. Basically, there are currently 3 tables in the one database, and more to be added as soon as I can get it working. Users - To display and store user data, such as username, email, password etc Posts - To store and display a post on the frontend Settings - Just basic site settings such as Site Name, Slogan etc. I am pretty new to MySQL/PHP etc so........ :-\ Yeah. Quote Link to comment https://forums.phpfreaks.com/topic/240776-selecting-more-than-two-tables-to-display-on-same-page/#findComment-1236691 Share on other sites More sharing options...
vicdesigns Posted June 30, 2011 Author Share Posted June 30, 2011 Also, what relationship exists between the data in these three tables? If there is no relationship between the data in the three tables, you should not have them in the same query because the result you get is not what you think it is. If I put them in separate queries, the php does not execute on the page. Quote Link to comment https://forums.phpfreaks.com/topic/240776-selecting-more-than-two-tables-to-display-on-same-page/#findComment-1236734 Share on other sites More sharing options...
PFMaBiSmAd Posted June 30, 2011 Share Posted June 30, 2011 If I put them in separate queries, the php does not execute on the page. That would indicate that your logic is incorrect or has a php syntax error and you need to troubleshoot what it wrong with it and find out what it is actually doing. If you want help with some specific code, you need to post it along with a statement of what it did when you tried it and post any errors you got as well, but putting multiple unrelated tables in a single query is incorrect. Quote Link to comment https://forums.phpfreaks.com/topic/240776-selecting-more-than-two-tables-to-display-on-same-page/#findComment-1236790 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.