Re: Mysql PDO statement with params in HAVING problem
| From: | Jim Giner | Date: | Thu, 27 Jun 2013 13:11:28 +0000 |
| Subject: | Re: Mysql PDO statement with params in HAVING problem | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-48768@lists.php.net to get a copy of this message | ||
On 6/27/2013 7:51 AM, Alexander Pletnev wrote:
Hi everyone, im new here, so please correct me if i created or formated topic incorrectly. I found a problem. I have a simple query for my needs:Second - you create and 'bind' the parameters to it Third - you execute the now completed query Fourth - you process the results.$stmt = $dbh->prepare("SELECT concat(first_name,' ',last_name) as full_name,t.* FROMIt works fine, until i add a param to my query:specialiststHAVING full_name like '%john%'"); $stmt->execute(); while($row = $stmt->fetch()) { echo '<pre>'; var_dump($row); echo '</pre>'; }$stmt = $dbh->prepare("SELECT concat(first_name,' ',last_name) as full_name,t.* FROMNow there is nothing in fetch(). Is it a bug ? Thanks. First - you prepare the queryspecialiststHAVING full_name like '%:query%'"); $stmt->execute(); $query = 'londo'; $stmt->bindParam(':query',$query); while($row = $stmt->fetch()) { echo '<pre>'; var_dump($row); echo '</pre>'; }