Thread: Insert Text
i allow my users to insert notes. when they leave the note blank, "" gets inserted into the db. is this expected behavior? tia... __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
On Jan 31, 2006, at 10:04 , <operationsengineer1@yahoo.com> wrote: > i allow my users to insert notes. when they leave the > note blank, "" gets inserted into the db. is this > expected behavior? tia... What do *you* expect? How are you inserting into the database? Look at the INSERT statement that is being used. I suspect you're using some kind of scripting language for your front-end, and your variable that holds the note is an empty string. In this case, inserting an empty string is to be expected. If you want it to insert something else (or not insert anything at all), you're probably going to have to modify your front-end or perhaps write a stored procedure to handle your insert. Michael Glaesemann grzm myrealbox com
In a web app, if it's a text area, the param will appear as an empty string in PHP. If you then pass this along to ADOdb, it'll populate the db as an empty string. If you don't want this behavior, then check for empty strings before insert and substitute NULL or drop the field from the array before insertion. Charley operationsengineer1@yahoo.com wrote: > i allow my users to insert notes. when they leave the > note blank, "" gets inserted into the db. is this > expected behavior? tia... > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org