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

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)    

 [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


 [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().