Error Message when using result() command
Posted on 2003-03-08
I'm just trying to do an ordinary retrieval of data from a database table. This is my code:
$zipfilename = "xtranix.zip";
$userid = "adagwg2g2h24";
$payment_gross = 13.26;
$connection = mysql_connect( $DB_HOSTNAME, $DB_USERNAME, $DB_PASSWORD ) or die( "Unable to select database");
$res = mysql_db_query( $DB_NAME, "SELECT * FROM PHPAUCTIONPROPLUS_users WHERE id=$userid");
$old_profit = mysql_result( $res, 0, 'personalinfo5');
Of course, this code has been stripped down to get to the source of the problem. When I go to this page, I get the following error:
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/url/url/url/test.php on line 12
Line 12 is $old_profit = mysql_result( $res, 0, 'country');
There is no problem connecting to the database and no problem with the passwords or setup information; I tried using the same exact code but with a different table and different column and it worked perfectly. For some reason, it doesn't like this table. I also tried selecting other columns from the same table, and it still generated the same error.
Any help would be greatly appreciated.