Mysql PDO statement with params in HAVING problem

[email protected] (Alexander Pletnev)
Newsgroups php.db
Message-ID <[email protected]>
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:

    $stmt = $dbh->prepare("SELECT concat(first_name,' ',last_name) as
    full_name,t.* FROM `specialists` `t` HAVING full_name like '%john%'");
    $stmt->execute();
    while($row = $stmt->fetch())
    {
       echo '<pre>'; var_dump($row); echo '</pre>';
    }

It works fine, until i add a param to my query:

    $stmt = $dbh->prepare("SELECT concat(first_name,' ',last_name) as
    full_name,t.* FROM `specialists` `t` HAVING full_name like '%:query%'");
    $stmt->execute();
    $query = 'londo';
    $stmt->bindParam(':query',$query);
    while($row = $stmt->fetch())
    {
       echo '<pre>'; var_dump($row); echo '</pre>';
    }

Now there is nothing in fetch(). Is it a bug ?

Thanks.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.