Mysql/php bind_param set null -


it saying "error: column 'delivereddate' cannot null."

$delivereddate = null; $stmt = $connection->prepare("insert orders (receiptid, date, cid, cardno, expirydate,      expecteddate, delivereddate) values (?,?,?,?,?,?,?)"); $stmt->bind_param("sssssss", $receiptid, $date, $cid, $cardno, $expirydate, $expecteddate, $delivereddate); 

the related table is:

create table orders( receiptid char(30) not null, date date not null, cid char(30) not null, cardno char(30) not null, expirydate date not null, expecteddate date not null, delivereddate date,  primary key(receiptid)); 

i tried inserting values in mysql workbench , can do:

insert orders value (1, '2012-12-10', 1, 1, '2014-2-3', '2012-12-23', null); 

try this

$delivereddate = '2014-11-26 10:40:35';  // date $stmt = $connection->prepare("insert orders (receiptid, date, cid, cardno, expirydate,      expecteddate, delivereddate) values (?,?,?,?,?,?,?)"); $stmt->bind_param("sssssss", $receiptid, $date, $cid, $cardno, $expirydate, $expecteddate, $delivereddate); 

i think error due $delivereddate = null;

comment errors...


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -