Jump to content

[SOLVED] weird mysql result


acidglitter

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  :))

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.