note 109030 added to pdostatement.execute

From: Date: Thu, 14 Jun 2012 10:32:29 +0000
Subject: note 109030 added to pdostatement.execute
Groups: php.notes 
Request: Send a blank email to php-notes+get-188597@lists.php.net to get a copy of this message
hi, just a qick note to get started without problems when using quotation: PDO does NOT replace given variables if they are wrapped in quotationmarks, e.g. <?php $st = $db->prepare( ' INSERT INTO fruits( name, colour ) VALUES( :name, ":colour" ) '; $st->execute( array( ':name' => 'Apple', ':colour' => 'red' ) ); ?> results in in a new fruit like -> Apple, :colour without the colour beeing replaced by "red". so leave variables WITHOUT the quotation - PDO will do. ---- Server IP: 69.147.83.197 Probable Submitter: 91.97.176.153 ---- Manual Page -- http://www.php.net/manual/en/pdostatement.execute.php Edit -- https://master.php.net/note/edit/109030 Del: integrated -- https://master.php.net/note/delete/109030/integrated Del: useless -- https://master.php.net/note/delete/109030/useless Del: bad code -- https://master.php.net/note/delete/109030/bad+code Del: spam -- https://master.php.net/note/delete/109030/spam Del: non-english -- https://master.php.net/note/delete/109030/non-english Del: in docs -- https://master.php.net/note/delete/109030/in+docs Del: other reasons-- https://master.php.net/note/delete/109030 Reject -- https://master.php.net/note/reject/109030 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#188597) next »