update in php and datatype question

Поиск
Список
Период
Сортировка
От Kevin Coyner
Тема update in php and datatype question
Дата
Msg-id 20030506025511.GO12559@rustybear.com
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Application Development with PostgreSQL
Следующее
От: Manfred Koizar
Дата:
Сообщение: Re: Optimizing POSTGRESQL config