retriving real values from mysql instead of resource id's

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
snpo123
Forum Commoner
Posts: 77
Joined: Sat Apr 17, 2004 6:31 pm

retriving real values from mysql instead of resource id's

Post by snpo123 »

hey, i was wondering how to get a real value from a mysql database without just retriving a resource id. For example, a script like this:

Code: Select all

<?php
include ('mysql_connect.php');
$get_money = "SELECT money FROM stats WHERE user_id = $userid" ;
$money = @mysql_query ($get_money);
echo "$money";
?>
will give me a result like "Resource ID#1", when what i really want is the value that is stored in the database. what am I doing wrong and how to I access things in the database?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

$query = mysql_query($get_money) or die(mysql_error());
list($money) = mysql_fetch_row($query) or die(mysql_error());
there's also mysql_result() I think..
Post Reply