php PDO bindParam using empty string

18 views Asked by At

I'm not sure about this behaviour.

$query = 'INSERT INTO XXX (row1) VALUES (:myparam)';
$stmt = $mycon->prepare($query);
$stmt->bindParam(':myparam','',PDO::PARAM_STR);

above code will fail at third line. When I use following code, everything works fine. What's the (internal) difference?

$query = 'INSERT INTO XXX (row1) VALUES (:myparam)';
$stmt = $mycon->prepare($query);
$empty = '';
$stmt->bindParam(':myparam',$empty,PDO::PARAM_STR);

Regards Jens

0

There are 0 answers