Jump to content

Recommended Posts

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?

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.

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.

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.