Trouble with mysql_fetch_array

Hi all, having a slight problem. I have an if statement. If it is true, I want run a while loop which it is doing kind of…though it’s only displaying one record when I actually have two records in the database.

I’m presuming it’s because I have used $rev=mysql_fetch_array($userRev) twice?

<?php 
$userRev = mysql_query("SELECT * FROM prodreviews WHERE prodid='$url'");
if ($rev=mysql_fetch_array($userRev)){
while ($rev=mysql_fetch_array($userRev)){
echo '<span style="color: #CCC; font-weight: bold;">'.$rev['title'].'</span><br/>';
echo '<span style="color: #666; font-size: 10px;">Posted by '.$rev['user'].' on '.$rev['dateTime'].'</span><br/>';
echo '<span>'.$rev['content'].'</span><br/>';
}}
else {echo "There are currently no reviews for this item.";}
?>

Appreciate the help as always :slight_smile:

Ok, been a douchebag, worked it out now and working swimmingly. Just needed to use the following above my while loop.

mysql_data_seek($userRev, 0);

Hi, try replacing


if ($rev=mysql_fetch_array($userRev)){

with


if ($rev=mysql_num_rows($userRev)){