Page is not loaded with the following PHP code:

<?php
$got=0;$numpoke=0;$total=0;$getpokes1=0;$poke1=0;
$getpokes1 = mysql_query('SELECT * FROM users WHERE wereld = "wonder" ORDER BY naam ASC');
$total = mysql_num_rows($getpokes1);
while ($poke1 = mysql_fetch_array($getpokes1)) {
if ($_SESSION['id']) {
$wildid = $poke1['id'];
$got = mysql_num_rows(mysql_query('SELECT id FROM utable WHERE id = "'.$poke1['id'].'" && user_id = "'.$user['user_id'].'"'));
if ($got>=1) { $kanto[$wildid] = 1; $numpoke++; }
}
} ?>
<th colspan="7" style="font-size:16px;letter-spacing:1px">Your list
(<?php if ($_SESSION['id']) { echo ''.$numpoke.'/'.$total.' in your ilst'; } else echo login to see the list';?>)</th></tr><tr></th></tr><tr>
<?php
$j=0;
$getpokes = mysql_query('SELECT * FROM users WHERE wereld = "wonder" ORDER BY naam ASC');
while ($poke = mysql_fetch_assoc($getpokes)) {
if ($kanto[$poke['id']] == 1) $got = 1;
$j++;
?>
<td class="pokestyle" <?php if ($got==1) echo 'style="background-color:#9CFD99"';?>><a href="?page=list&id=<?=$poke['id']?>"><?=$poke['naam']?></a><br/></td>
<?php if ($j%8 == 0) echo'</tr><tr>'; } ?>

When I remove the following line:
[B]

$got = mysql_num_rows(mysql_query('SELECT id FROM utable WHEREid = "'.$poke1['id'].'" && user_id = "'.$user['user_id'].'"'));

[/B]

The code works. But I need this line to check if the record exist in another table.
the utable is a big table with more than 159,528 records.
There is no code PHP error. the page is loading forever like unlimited loop.

Based on the code you posted there is 2 issues straight away I’ve noticed which should trigger an error as it’s invalid SQL syntax.

$got = mysql_num_rows(mysql_query('SELECT id FROM utable [COLOR=#FF0000]WHEREid[/COLOR] = "'.$poke1['id'].'" [COLOR=#FF0000]&&[/COLOR] user_id = "'.$user['user_id'].'"'));
  1. WHERE and id should have a space between them
  2. && isn’t valid in SQL, you need to use the equivalent AND, OR etc. words

Also a table with 159,000+ records shouldn’t cause any issues unless you haven’t setup indexing which 99% of the time assists in slow requests but ultimately optimizing the table does more than an index.

the WHEREID is mistakely happenned because I edited some of the code in this topic. Also, if it was the problem, the page was running, but now it’s not running - and loads.
I am using in many places in my website the && and it works perfectly. Anyway I changed it to AND but the problem still exist.

Edit:
Changing my variable names fixed the problem. I think I have used them previous in the code, and it made some bugs. Thank you for you assisting.