note 77039 added to function.pdostatement-bindparam

From: Date: Sun, 12 Aug 2007 15:34:08 +0000
Subject: note 77039 added to function.pdostatement-bindparam
Groups: php.notes 
Request: Send a blank email to php-notes+get-129422@lists.php.net to get a copy of this message
I can't use wildcards in my prepared statements, using it like follows: $stmt = $pdh->prepare("SELECT id, uname FROM tbl WHERE uname LIKE :uname OR email LIKE :email OR firstname LIKE :fn OR lastname LIKE :ln"); $un = "%" . $un . "%"; $em = "%" . $em . "%"; $fn = "%" . $fn . "%"; $ln = "%" . $ln . "%"; $stmt->bindParam(":uname", $un); $stmt->bindParam(":email", $em); $stmt->bindParam(":fn", $fn); $stmt->bindParam(":ln", $ln); This is not giving me any error messages or exceptions, it's just not returning any rows. (And there are rows matching the query...) Running PHP5.2.3, MySQL5.0.45 and Apache2.2.4 in Windows. ---- Server IP: 129.16.214.50 Probable Submitter: 193.11.241.253 ---- Manual Page -- http://www.php.net/manual/en/function.pdostatement-bindparam.php Edit -- https://master.php.net/note/edit/77039 Del: integrated -- https://master.php.net/note/delete/77039/integrated Del: useless -- https://master.php.net/note/delete/77039/useless Del: bad code -- https://master.php.net/note/delete/77039/bad+code Del: spam -- https://master.php.net/note/delete/77039/spam Del: non-english -- https://master.php.net/note/delete/77039/non-english Del: in docs -- https://master.php.net/note/delete/77039/in+docs Del: other reasons-- https://master.php.net/note/delete/77039 Reject -- https://master.php.net/note/reject/77039 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#129422) next »