Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Printing out an int in php/MySQL
Old 02-14-2006, 10:49 AM Printing out an int in php/MySQL
Novice Talker

Posts: 8
Trades: 0
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..
Metalmikey666 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-14-2006, 10:58 AM Re: Printing out an int in php/MySQL
Novice Talker

Posts: 8
Trades: 0
All,

I have sorted this now (sorry).

For anyone who also has this problem - php code is case sensative, and mysql queries aren't! and it doesn't throw up an error when you make a mistake like this, it just does what it did to me (i.e. drives you insane!).

-Mike
Metalmikey666 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Printing out an int in php/MySQL
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.35852 seconds with 12 queries