PHP Code:$usera=$db->get_row("SELECT * FROM b_users ORDER BY rand() LIMIT 3");
Please anytime i want to display my members photo like 2 or 3 it always giving me more that what i wanted. Eg. I want to display 3 userz photo in random, it will display more than 50 images. Pls whats wrong.PHP Code:<?php
$usera=$db->get_row("SELECT * FROM b_users ORDER BY rand() DESC LIMIT 0,3");
if($usera)
{
foreach($usera as $userd8)
{
if (!empty($userd8->avatar))
print "<tr><td><div class=\"advert\"><img src=\"".$config->url."/avatars/".$userd8->avatar."\"
width=\"70\" height=\"70\"> ";
//else, print gravatar
else if($userd8->sex == "female") echo "<img src=\"".$config->url."/avatars/avatarf.png\" width=\"70\" height=\"70\"></img>"; else echo "<img src=\"".$config->url."/avatars/avatarm.png\" width=\"70\" height=\"70\"></img>";
}
}
?>
PHP Code:$usera=$db->get_row("SELECT * FROM b_users ORDER BY rand() LIMIT 3");
thanx man. but still not working... it still giving me multiple photos
PHP Code:$usera=$db->get_row("SELECT * FROM b_users ORDER BY RAND() LIMIT 0,3");
thanx let me try...
Originally Posted by Devil223 [Only registered and activated users can see links. Click Here To Register...]
sorry i edited it before you tried it lol should be limit 3 not 0, 3
hmm, try both bt still not working
What are the symptoms?
Try to remove foreach loop, in get_row should be while() already.
Last edited by arnage; 24-03-12 at 16:38.
<!DOCTYPE html PUBLIC "-//WAPFORUM.RS
Can u give me da sample code using the while() loop
PHP Code:while ($usera = mysql_fetch_array($userd8)) {
}
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks