note 73214 deleted from function.PDOStatement-bindParam by tularis

From: Date: Tue, 13 Feb 2007 17:50:50 +0000
Subject: note 73214 deleted from function.PDOStatement-bindParam by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-123328@lists.php.net to get a copy of this message
Note Submitter: Zarquod ---- 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?

« previous php.notes (#123328) next »