|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26088 problem with mysql_fetch_object()
Submitted: 2003-11-02 19:54 UTC Modified: 2003-11-17 18:16 UTC
Avg. Score:3.2 ± 0.4
Reproduced:3 of 4 (75.0%)
Same Version:1 (33.3%)
Same OS:2 (66.7%)
From: nathan_jackson at iprimus dot com dot au Assigned:
Status: No Feedback Package: MySQL related
PHP Version: 4.3.3 OS: Windows XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: nathan_jackson at iprimus dot com dot au
New email:
PHP Version: OS:


 [2003-11-02 19:54 UTC] nathan_jackson at iprimus dot com dot au
I am trying to login a user. I want to get the users name and account type from the database the store them in a cookie.
I am recieving this message when I try to run the script:
"Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in C:\Project\Music Manager\check_login.php on line 14"

I am using IIS on Windows XP.

Reproduce code:
  $password = crypt($HTTP_POST_VARS["password"]);

  $connec = mysql_connect("localhost", "root", "farmer01");
    $data = mysql_query( "SELECT username, name_first,  
                          name_last, acc_type FROM user 
	                  WHERE username 
                         = ".$HTTP_POST_VARS['username']." 
                          AND password = ".$password."");

    If (!$data){
	  header("Location: /err_login.php"); }
    else {	  
	  $row = mysql_fetch_object($data);
	  $values = "".$row->username."|".$row->name_first.
	  setcookie( "user", $values ); 

Expected result:
I was expecting that all of the values above would have been placed into the cookies "user"as a string. To later be seperated by the explode() function.

Actual result:
I recieved this message:
"Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in C:\Project\...\check_login.php on line 14"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-03 18:54 UTC]
Try adding 'echo mysql_error();' and 'var_dump($data);'
after the mysql_query() call.

 [2003-11-17 18:16 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 18 02:01:29 2024 UTC