update in php and datatype question

From: Kevin Coyner <kevin(at)rustybear(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: update in php and datatype question
Date: 2003-05-06 02:55:11
Message-ID: 20030506025511.GO12559@rustybear.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice


I've run into a situation using Postgres and PHP that has me baffled:

Here's a snippet of the php/sql code involved:

$updateQuery = "UPDATE $activitytype
SET descr = '".$descr."',
WHERE aid = '".$aid."'
AND datetime = '".$datetime."' ";

In an earlier statement, the attribute descr is created as an integer
and the variable $descr is set to NULL.

When this executes, it produces a DB error: unknown error statement.

But if I go and change the attribute descr to either a float or a
varchar(10), then the above update works just fine.

It just doesn't work if the attribute descr is an integer.

Also note that if I enter the above Update via the console using psql,
then it works even if the attribute descr IS AN INTEGER. So somewhere
in the PHP process it might be getting fowled up?

Hope someone can set me straight as the attribute descr is really best
desbribed as an integer, but I may have to use it as a float to get this
thing to work. Nevertheless, I'd like to understand what's going on.

Thanks
Kevin

--
Kevin Coyner
mailto: kevin(at)rustybear(dot)com
GnuPG key: 1024D/8CE11941

Browse pgsql-novice by date

  From Date Subject
Next Message Manfred Koizar 2003-05-06 07:19:38 Re: Optimizing POSTGRESQL config
Previous Message Tom Lane 2003-05-05 23:36:26 Re: Application Development with PostgreSQL