Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.12.2

Bug #2368 Using getRow() with an mysql UPDATE command results in a fatal error
Submitted: 2004-09-21 22:28 UTC
From: sebastian at herbajet dot com Assigned: danielc
Status: Bogus Package: DB
PHP Version: 4.2.2 OS: Linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 30 + 28 = ?

 
 [2004-09-21 22:28 UTC] sebastian at herbajet dot com
Description: ------------ When i use getRow() with an mysql UPDATE command results in a fatal error. This is of course not the right use of the function but it shouldnt result in a PHP fatal error Reproduce code: --------------- $db_result = $this->content->db->query("UPDATE users SET firstname='$firstname', lastname='$lastname', email='$email', telephone='$telephone' WHERE id='$id'"); if(DB::isError($db_result)) die($db_result->getMessage()); Expected result: ---------------- the row in the database should get update or just return false since i should use query insted?! Actual result: -------------- Fatal error: Call to a member function on a non-object in /usr/share/php/PEAR/DB/common.php on line 765

Comments

 [2004-09-21 22:46 UTC] danielc
The manual for getRow() says it "runs the query provided and puts the first row of data into an array then frees the result set." Only SELECT queries return result sets. Data changing queries, such as UPDATE, INSERT and DELETE, return boolean so can't be used with getRow().