Page 1 of 1

MySQL only returning one row - PLEASE HELP...

Posted: Fri Feb 27, 2009 11:06 am
by besly98
Hi all... this is my code and the sql is only pulling out 1 row... im baffled as to why. any ideas anyone?

<?


$sql3 = "SELECT * FROM wall WHERE id='".$userUNid."' ORDER BY orderid DESC LIMIT 3";
$results = mysql_query($sql3);
$arr = mysql_fetch_row($results);
$message = $arr[2];
$postid = $arr[3];


$sql2 = mysql_query("SELECT * FROM members WHERE id='".$postid."' ") or die ('Error: '.mysql_error ());
while($row = mysql_fetch_array($sql2))
{


echo "<h2 style='padding: 0px; margin: 15px 0px 7px 0px;'>Dougout</h2><div class='dogoutimg'><img src='http://www.jdbesly.co.uk/test/home/upload/";
echo $row['image'] ;
echo "' style='width: 60px;' /></div><div class='dougout' style='float: right;'>";
echo $message;
echo "</div>";
}

mysql_close($con);
?>


Report this post

Re: MySQL only returning one row - PLEASE HELP...

Posted: Fri Feb 27, 2009 12:55 pm
by VladSun
Assuming that you have a proper DB design, obviously it's because of the WHERE clause

WHERE id='".$userUNid."'

So, I don't think wall.id should be used.

Re: MySQL only returning one row - PLEASE HELP...

Posted: Fri Feb 27, 2009 12:59 pm
by besly98
the ptoblem is that i have an image in another table im trying to link to an id in another table.... so if that id matchess the image id.. show that picture with the other id's mesage