|
Hi all,
This is driving me nuts. I have a database of recepies, and I'm trying to write a piece of code to export the top five recepies as voted for by the visitors to the site. the table looks like this;
RecepieID INT(5)
RecepieName varchar(50)
Ingredients (Text)
Method (text)
Votes_number INT(6)
and the code i'm using looks like this;
<?
$query = "select * from recepies ORDER BY votes_number DESC LIMIT 5";
$result = mysql_query($query, $connection) or die("failed");
while($row = mysql_fetch_array($result))
{
extract($row);
echo"$row[RecepieName] - <i>$row[votes_number] votes)</i><br>";
}
?>
which is producing this! (yeah, these are dummy recepies btw!)
Eggs ( votes)
Sunday Roast ( votes)
bangers and mash ( votes)
Pancakes ( votes)
Salmon pasta bake ( votes)
and i can't figure out why it isn't printing out my 'votes_number' information! Its ordering them correctly, its just not printing it out. I can't even print out the recepies ID, do you have to do something special with ints?
Last edited by Metalmikey666; 02-14-2006 at 10:51 AM..
|