?
Solved

Error Message when using result() command

Posted on 2003-03-08
3
Medium Priority
?
168 Views
Last Modified: 2008-03-06
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
Comment
Question by:xtranixcom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 6

Accepted Solution

by:
carchitect earned 600 total points
ID: 8096849
check table name
table name is wrong
check for case sensitivity.....
regards
0
 

Author Comment

by:xtranixcom
ID: 8097667
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
 

Expert Comment

by:shivabharat
ID: 8105079
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

Tutorial: Introduction to Managing a Linux Server

In this tutorial on systemd, we will explore:
-OS/Distro Adoption
-chkconfig and Other Legacy Commands
-Summary and Key Commands

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question