Jump to content

[SOLVED] MySQL query problem - Looped results


sandstorm140

Recommended Posts

Hello,

I'm using the following code. I'm wanting to display usernames from

database: usernames

table: users

from field: online

where online = 1.

 

As you can see, i also have FROM accounts.accounts because later on I will need to pull information from that database simultaneously.

Database: accounts

table: accounts

--Also has a field named "online".

 

My problem is I should have 4 results equal to usernames.users.online=1.

I get the correct 4 names, however, it seems to be looped over and over again hundreds of times.

 

For example:

username1

username2

username3

username4

//starts again..

username1

username2

username3

username4

...etc

 

SELECT
usernames.users.name, usernames.users.online
FROM
usernames.users,
accounts.accounts
WHERE
usernames.users.online =  '1'

 

I'm fairly new to MySQL, any help/advice would be splendid.

 

Thanks in advance.

Link to comment
Share on other sites

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.