Use a INNER JOIN.

For table one you should have multi rows soFor a database I have 2 tables setup, they are like-
I need to order the first table by num (SELECT * FROM `table1` ORDER BY `num` DESC) then I need to match the ID of that to the id in table 2. And it probs needs to be done in 1 mysql query because it needs to be used with mysql_fetch_assoc().
Sorry if what I've said is confusing. I have tried my best to explain it
+Rep for any help
Thanks.
ID (Article ID)
UserID (The users ID, thats it)
$query = mysql_query( "SELECT * FROM `table1` WHERE `ID` = '213'" );
$peopleVoted = mysql_num_rows( $query );
$f = mysql_fetch_array( $query );
$query_2 = mysql_query( "SELECT * FROM `table2` WHERE `ID` = '" . $f[ 'ID' ] . "' LIMIT 1" );
$r = mysql_fetch_array( $query_2 );
I dont really get it but thats how I see it.
Hi, names James. I am a web developer.
Want to hide these adverts? Register an account for free!