[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 169
  • Last Modified:

Error Message when using result() command

I'm just trying to do an ordinary retrieval of data from a database table. This is my code:

<?php

     include('pwfile.config');
     $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');
                    echo $old_profit;

?>

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.

Thank you.
0
xtranixcom
Asked:
xtranixcom
1 Solution
 
carchitectCommented:
check table name
table name is wrong
check for case sensitivity.....
regards
0
 
xtranixcomAuthor Commented:
I know the tables are case sensitive, that wasn't the problem...

I had to put some personalinfo5 in double quotes and $userid in single quotes..I forgot to do that.

I'll award you the points just for making a quick effort at answering the question.

Thanks anyway carchitect.
0
 
shivabharatCommented:
Try this

$res = mysql_query( $DB_NAME, "SELECT * FROM PHPAUCTIONPROPLUS_users WHERE id=$userid");

$old_profit = mysql_result($res,0,"country");


Hope this helps!
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now