OK Heres the problem I connect to my database and select table A then I loop and search Table B and where ID of A = ID of B shows the results. But becasue the First Entry of Table A doesnt have an ID in Table B it comes up with an error.
$sql = "SELECT * FROM game_name";
$result=mysql_db_query($db, $sql);
$num=mysql_num_rows($result);
for ($i=0; $i < $num; $i++){
$sql1 = "SELECT * FROM game_cheats WHERE ga_id=$id";
$id= mysql_result($result, $i, "g_id");
$name=mysql_result($result, $i, "name");
//$x=$i+1;
$res =mysql_query($sql1);
$numb = mysql_num_rows($res);
if ($numb <= 0) {} Else {
echo " ".$name." <B>".$id."</B><BR>";
}
}
The Error is : Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /Location of File/test.php on line 13
Red Ninja: End of Honor 2
Pokemon Dash 5
Tony Hawk's Underground 2 Remix 7
Battlefield 2 8
Spikeout: Battle Street 14
Grand Theft Auto: Vice City 19
Wich I know and Understand why it happens but is there some way to remove that I thought of useing this sql stament but my database doesnt like it.
SELECT * FROM game_name a, game_cheats b WHERE a.g_id=b.ga_id
and game_name has g_id as well game_cheats has ga_id so what am I doing wrong with ether the code or the SQL because the SQL doesnt work and I told ya the problem with the Code