Jump to content

check this out


dhimok

Recommended Posts

Take a look at this loop. I am trying to limit the result to 5, but no help. Thats because the first loop has many results. Any idea how to limit the result

 

<?php

$sql = mysql_query("SELECT * FROM tbl_o
WHERE id = '$id'
ORDER BY rand()
");

while($o = dbFetchObject($sql)) {
           $sql2 = mysql_query("SELECT * FROM tbl_o INNER JOIN tbl_p ON tbl_o.id = tbl_p.id WHERE nr = '".$o->nr."' ORDER BY rand() LIMIT 5");
              while($p = dbFetchObject($sql2)) {
                 echo $p->some_name;
              }
        }

?>

Link to comment
https://forums.phpfreaks.com/topic/68753-check-this-out/
Share on other sites

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.