Page 1 of 1

retriving real values from mysql instead of resource id's

Posted: Tue May 18, 2004 7:39 pm
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?

Posted: Tue May 18, 2004 7:44 pm
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..