Re: invalid number error in update query
| From: | James 'Chip' Kaufman | Date: | Wed, 28 May 2003 17:05:37 +0000 |
| Subject: | Re: invalid number error in update query | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-5664@lists.php.net to get a copy of this message | ||
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.
--
James 'Chip' Kaufman
jkaufman@wamnet.com
PGP key: 697D43DE