Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
[SOLVED] Grabbing data from another table using INNER Join.
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Brad" data-source="post: 362823" data-attributes="member: 17995"><p>So I'm trying to grab items from a table WHERE the items ID = 202, but where the user_ids RANK is < 4 . but the Items table doesn't define the rank so you'd have to grab that from the other table (users). I'm using INNER JOIN which I've never done before and it's confusing the hell out of me.</p><p></p><p>Here's my current code.</p><p>[PHP] </p><p> $result = mysql_query("SELECT i.base_item, i.user_id FROM items WHERE i.base_item ='202' AS i</p><p> INNER JOIN users AS u</p><p> ON i.user_id= u.id WHERE u.rank < 4");</p><p> </p><p> $num_rows = mysql_num_rows($result);[/PHP]</p><p>This isn't grabbing anything so I don't know what needs fixing. Thanks</p></blockquote><p></p>
[QUOTE="Brad, post: 362823, member: 17995"] So I'm trying to grab items from a table WHERE the items ID = 202, but where the user_ids RANK is < 4 . but the Items table doesn't define the rank so you'd have to grab that from the other table (users). I'm using INNER JOIN which I've never done before and it's confusing the hell out of me. Here's my current code. [PHP] $result = mysql_query("SELECT i.base_item, i.user_id FROM items WHERE i.base_item ='202' AS i INNER JOIN users AS u ON i.user_id= u.id WHERE u.rank < 4"); $num_rows = mysql_num_rows($result);[/PHP] This isn't grabbing anything so I don't know what needs fixing. Thanks [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
[SOLVED] Grabbing data from another table using INNER Join.
Top