dhimok Posted September 10, 2007 Share Posted September 10, 2007 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.