update in php and datatype question - Mailing list pgsql-novice

From Kevin Coyner
Subject update in php and datatype question
Date
Msg-id 20030506025511.GO12559@rustybear.com
Whole thread Raw
List 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@rustybear.com
GnuPG key: 1024D/8CE11941


pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: Application Development with PostgreSQL
Next
From: Manfred Koizar
Date:
Subject: Re: Optimizing POSTGRESQL config