Re: Interbase: how can I insert null values with placeholders?

From: Date: Fri, 06 Jul 2001 19:15:23 +0000
Subject: Re: Interbase: how can I insert null values with placeholders?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-10127@lists.php.net to get a copy of this message
Hi KM-- The general format for the INSERT goes something like this: INSERT INTO anytable (columnname) VALUES (NULL); You technically do not need the newlines ("\n") in your $stmt. So I guess I'm saying that in the code if you change the $asinteger assignment to: $asinteger = "NULL"; /* notice the quotes */ it may work. This would make the $asinteger PHP variable a string, but since the SQL would either like to have a numeric value there or the keyword NULL, that is probably what you want. Good luck, Doug At 07:23 PM 7/6/01 +0200, Kiss Marton wrote: >Hi! > >I like to insert null values with placeholders in ibase_query. But it >doesn't work. > >$stmt = "insert into category_prop \n". > "(id, category_id, category_prop_type_id, asinteger, asfloat, >ascurrency, asstring) \n". > "values (gen_id(gen_category_prop_id,1),1097,109,?,?,?,?)"; > >$asinteger = null; >$asfloat = 2.5; >$ascurrency = 3; >$asstring = "apple"; > >$sth = ibase_query($dbh, $stmt, > $asinteger, > $asfloat, > $ascurrency, > $asstring); > >This statement insert '0' instead null. Why? > >Best Regards, >Kiss Marton >martin@eaglesoft.hu

« previous php.db (#10127) next »