note 108245 added to pdostatement.execute
| From: | T-Rex | Date: | Wed, 11 Apr 2012 15:44:53 +0000 |
| Subject: | note 108245 added to pdostatement.execute | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-187055@lists.php.net to get a copy of this message | ||
When you try to make a query with a date, then take the whole date and not just a number.
This Query will work fine, if you try it like this:
SELECT * FROM table WHERE date = 0
But if you try it with prepared you have to take the whole date format.
<?php
$sth = $dbh->prepare('SELECT * FROM table WHERE date = :date');
$sth->execute( $arArray );
//--- Wrong:
$arArray = array(":date",0);
//--- Right:
$arArray = array(":date","0000-00-00 00:00:00");
?>
There must be something with the mysql driver.
best regards
T-Rex
----
Server IP: 87.106.1.137
Probable Submitter: 62.156.57.186
----
Manual Page -- http://www.php.net/manual/en/pdostatement.execute.php
Edit -- https://master.php.net/note/edit/108245
Del: integrated -- https://master.php.net/note/delete/108245/integrated
Del: useless -- https://master.php.net/note/delete/108245/useless
Del: bad code -- https://master.php.net/note/delete/108245/bad+code
Del: spam -- https://master.php.net/note/delete/108245/spam
Del: non-english -- https://master.php.net/note/delete/108245/non-english
Del: in docs -- https://master.php.net/note/delete/108245/in+docs
Del: other reasons-- https://master.php.net/note/delete/108245
Reject -- https://master.php.net/note/reject/108245
Search -- https://master.php.net/manage/user-notes.php