On Thu, 14 Feb 2002, Bryan Tolka wrote:

> Hello everyone . I still cannot insert null values. The rest of the code
> below works execpt for the null updates. Anu ideas would be appreciated.
>
> > if ($ip ne $oldip){
> >     $sth = $dbh->prepare("update ipmgt set
> >             ip = '$oldip',
> >             hw = 'NULL' ,
> >             dnsName = 'NULL' ,
> >             userName = 'NULL',
> >             os = 'NULL',
> >             dept = 'NULL',
> >             notes = 'NULL',
> >             bootType = 'NULL',
> >             bootFile = 'NULL',
> >             bootHost = 'NULL'

I'm not sure what DBD you are using, but in my experience, NULL shouldn't
be quoted, otherwise, you are inserting the string NULL, rather than a
NULL value.  I tested a similar update against a PG database on a foreign
key field, and it let me insert NULL, but threw a referential integrity
violation error when I tried to insert 'NULL'.

-- Brett

                                          http://www.chapelperilous.net/
------------------------------------------------------------------------
We really don't have any enemies.  It's just that some of our best
friends are trying to kill us.

Reply via email to