Jump to content

Recommended Posts

this is what i have

$sql=mysql_query("SELECT
members.*,
categories.*
FROM members

INNER JOIN categories ON
categories.id = {$_SESSION['id']}

ORDER BY categories.category_order ASC, members.member_id ASC");

 

and for some reason its displaying each member once in every category instead of showing each member only once in the right category... does anyone see whats wrong with my code?

Link to comment
https://forums.phpfreaks.com/topic/88593-solved-weird-mysql-result/
Share on other sites

i don't think thats it :(

i tried simplifying the code and making a temporary field with the same id that {$_SESSION['id']} had and joining it to that and its still messing up..

 

like i'm still just testing everything, so right now there are 2 members and 3 categories, and i tried doing mysql_num_rows on the query and its saying there are 6 members.... :(

this is the exact code i have right now...

 

SELECT
train_1.*,
trains_categories.*

FROM train_1

INNER JOIN trains_categories ON
train_1.train_id = trains_categories.train_id

 

trains_categories has all of the categories for all of the trains. train_1 has all of the members for just that train

(just in case you didnt already figure that out  :))

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.