Re: [SQL] Inserting NULL into Integer column

2004-02-18 Thread scott.marlowe
On Wed, 18 Feb 2004, Rod Taylor wrote: > > Note that the ' marks aren't part of the string, they are the delimiter of > > the string, and I always run every server with magic_quotes_gpc on. > > > > anything else? :-) > > Good point. I looked at the single quotes of the second line and somehow >

Re: [SQL] Inserting NULL into Integer column

2004-02-18 Thread Rod Taylor
> Note that the ' marks aren't part of the string, they are the delimiter of > the string, and I always run every server with magic_quotes_gpc on. > > anything else? :-) Good point. I looked at the single quotes of the second line and somehow the DEFAULT got quoted as well ;) -

Re: [SQL] Inserting NULL into Integer column

2004-02-18 Thread scott.marlowe
On Wed, 18 Feb 2004, Rod Taylor wrote: > > and then you can foreach across the input: > > > > foreach($fields as $f){ > > if (!$_POST[$f]){ > > $_POST[$f]='DEFAULT'; > > } else { > > $_POST[$f] = "'".$_POST[$f]."'"; > > } > > } > > Default in quotes isn't going to work, and please

Re: [SQL] Inserting NULL into Integer column

2004-02-18 Thread Rod Taylor
> and then you can foreach across the input: > > foreach($fields as $f){ > if (!$_POST[$f]){ > $_POST[$f]='DEFAULT'; > } else { > $_POST[$f] = "'".$_POST[$f]."'"; > } > } Default in quotes isn't going to work, and please tell me you escape those things with pg_escape_string() at som

Re: [SQL] Inserting NULL into Integer column

2004-02-18 Thread scott.marlowe
On Wed, 18 Feb 2004, Jeremy Smith wrote: > > > I've run into this kind of thing before. IT helps if you have an array of > all your fields like: > > $fields = array("field1","field3","last_name"); > > and then you can foreach across the input: > > foreach($fields as $f){ > if (!$_POST[$f])

Re: [SQL] Inserting NULL into Integer column

2004-02-18 Thread Jeremy Smith
I've run into this kind of thing before. IT helps if you have an array of all your fields like: $fields = array("field1","field3","last_name"); and then you can foreach across the input: foreach($fields as $f){ if (!$_POST[$f]){ $_POST[$f]='DEFAULT'; } else { $_POST[$f] = "'".$_PO

Re: [SQL] Inserting NULL into Integer column

2004-02-18 Thread scott.marlowe
better checking, so it's a bit of a trade off. > Anyway, the help on this list is much appreciated.. > > Jeremy > > -----Original Message- > From: scott.marlowe [mailto:[EMAIL PROTECTED] > Sent: Wednesday, February 18, 2004 2:44 PM > To: Jeremy Smith > Cc:

Re: [SQL] Inserting NULL into Integer column

2004-02-18 Thread Jeremy Smith
-- From: scott.marlowe [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 18, 2004 2:44 PM To: Jeremy Smith Cc: [EMAIL PROTECTED] Subject: Re: [SQL] Inserting NULL into Integer column On Wed, 18 Feb 2004, Jeremy Smith wrote: > Hi, > > in mysql I was able to make an insert such as: > &g

Re: [SQL] Inserting NULL into Integer column

2004-02-18 Thread scott.marlowe
On Wed, 18 Feb 2004, Jeremy Smith wrote: > Hi, > > in mysql I was able to make an insert such as: > > INSERT INTO TABLE (integervariable) VALUES ('') > > and have it either insert that variable, or insert the default if it had > been assigned. In postgresql it gives and error every time that t

[SQL] Inserting NULL into Integer column

2004-02-18 Thread Jeremy Smith
Hi, in mysql I was able to make an insert such as: INSERT INTO TABLE (integervariable) VALUES ('') and have it either insert that variable, or insert the default if it had been assigned. In postgresql it gives and error every time that this is attempted. Since I have so many queries that do th