|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56367 Can't insert null values into table
Submitted: 2005-04-04 16:52 UTC Modified: 2005-07-08 19:15 UTC
From: gpd at gpdnet dot co dot uk Assigned:
Status: Closed Package: PDO_ODBC (PECL)
PHP Version: 5_1 CVS-2005-04-04 (dev) OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: gpd at gpdnet dot co dot uk
New email:
PHP Version: OS:


 [2005-04-04 16:52 UTC] gpd at gpdnet dot co dot uk
Using bindParam and named arguments in an insert statement or stored procedure call I can't find a way of inserting or updating fields with a null value.

I think I am using the correct code below according to the PDO documentation

I've tried various combinations of values and parameters, but I can't get it to insert a null value.

Reproduce code:
create table test (c1 int, c2 int);
$cn = new PDO('odbc:DRIVER={Adaptive Server Anywhere 9.0};ENG=webroster;DBN=cct8740;CommLinks=TCP','dba','sql');

$dr = $cn->prepare('insert into test(c1,c2) values(:c1, :c2)');
$val1 = 1;
$val2 = 2;

Expected result:
values 1 and null in the test table

Actual result:
values 1 and 2 in the test table


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-24 17:15 UTC] saruman at unigsm dot com
It seems that you'll get NULL in table only when $val2 === NULL:

$val1 = 1;
$val2 = NULL;
 [2005-06-24 17:30 UTC] gpd at gpdnet dot co dot uk
I did actually try that at the time and several other combinations as well. Did you try this code and sucessfully get a null value in the database?

I can't try it at the moment as the odbc driver seems to be missing from recent snapshots (already reported).
 [2005-07-08 13:10 UTC]
Should be fixed in the latest snap.
 [2005-07-08 19:15 UTC] gpd at gpdnet dot co dot uk
Tested and verified as fixed
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun May 16 08:01:24 2021 UTC