note 73214 added to function.PDOStatement-bindParam

From: Date: Tue, 13 Feb 2007 15:47:49 +0000
Subject: note 73214 added to function.PDOStatement-bindParam
Groups: php.notes 
Request: Send a blank email to php-notes+get-123325@lists.php.net to get a copy of this message
Just to get this absolutely straight: Is bindParam() (and bindValue() likewise) supposed to replace _all_ occurences of a parameter or just the first? Consider this situation: <?php $search = '%thomas%'; $q = 'SELECT * FROM Address WHERE LastName LIKE :search OR FirstName LIKE :search OR Street LIKE :search'; $stmt = $dbh->prepare($q); $stmt->bindParam(':search', $search); ?> I have, in fact, seen the Windows XP machine in my office replace all occurences and the Linux server at my ISP replace only the first occurrence. Both are running PHP 5.2.0, the Windows machine using its locally installed MySQL 5.0.27 and the server at the ISP using a seperate DB server with MySQL 5.0.30. So, which of these two variants is correct, as per specs of the PDO interface? ---- Server IP: 212.124.37.9 Probable Submitter: 217.85.187.53 ---- Manual Page -- http://www.php.net/manual/en/function.PDOStatement-bindParam.php Edit -- https://master.php.net/note/edit/73214 Del: integrated -- https://master.php.net/note/delete/73214/integrated Del: useless -- https://master.php.net/note/delete/73214/useless Del: bad code -- https://master.php.net/note/delete/73214/bad+code Del: spam -- https://master.php.net/note/delete/73214/spam Del: non-english -- https://master.php.net/note/delete/73214/non-english Del: in docs -- https://master.php.net/note/delete/73214/in+docs Del: other reasons-- https://master.php.net/note/delete/73214 Reject -- https://master.php.net/note/reject/73214 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#123325) next »