Re: invalid number error in update query

From: Date: Wed, 28 May 2003 17:28:06 +0000
Subject: Re: invalid number error in update query
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-5668@lists.php.net to get a copy of this message
On Wed, 2003-05-28 at 13:05, James 'Chip' Kaufman wrote: > On Wednesday 28 May 2003 10:49, Jeff Self wrote: > > I've got an update form that passes the values to another page for > > updating. Here's the code: > > > > require_once ("DB.php"); > > > > session_start(); > > > > page_header('Edit Job Listing Results'); > > > > // open connection to the database > > $db = DB::connect($dsn, FALSE); > > > > // Check whether the object is a connection or an error. > > // Print out a message and exit if it's an error object. > > if (DB::isError($db)) > > { > > die($db->getMessage()); > > } > > > > // get variables from editjoblisting.php > > $joblisting_id = $_REQUEST['joblisting_id']; > > $req_no = $_REQUEST['requisition_no']; > > $jobdescription_id = $_REQUEST['jobdescription_id']; > > $description = $_REQUEST['description']; > > $vacancies = $_REQUEST['vacancies']; > > $internal_only = $_REQUEST['internal_only']; > > $active = $_REQUEST['active']; > > $submitted_by = $_REQUEST['submitted_by']; > > > > // Query for editing Job Listing > > $query = "UPDATE joblisting SET vacancies='$vacancies' WHERE > > joblisting_id = '$joblisting_id'"; > > > > $result = $db->query($query); > > > > // Check the result object in case there was an error, and handle it > > here. > > if (DB::isError($result)) > > { > > echo "Query Error."; > > die($result->getMessage()); > > } > > > > ?> > > > > > > When I hit submit on the form, I get the following error message on > > this page: > > > > Query Error.DB Error: invalid number > > > > What is this invalid number mean? > > I displayed the passed variables and they all are correct with the > > changes showing. But the database doesn't get updated. > > > > -- > > Jeff Self > > Information Technology Analyst > > City of Newport News > > Personnel Department > > 2400 Washington Drive > > Newport News, VA 23607 > > 757-926-3741 > > If you modify the 'die' instructions like: > > $result->getDebugInfo() . " at line " . __line__ ); > > Then perhaps the debug information will prove useful. I'm guessing that > the failure occurs in the db connect. Check the $dsn variable. > OK here's what the debug message is telling me: Query Error.UPDATE joblisting SET vacancies='1' WHERE joblisting_id='1 For some reason, its cutting off the end of the query. -- Jeff Self Information Technology Analyst City of Newport News Personnel Department 2400 Washington Drive Newport News, VA 23607 757-926-3741

« previous php.pear.general (#5668) next »