You are here: PDO::prepare and SELECT WHERE LIKE « PHP Programming Language « IT news, forums, messages
PDO::prepare and SELECT WHERE LIKE

Posted by amygdala on 08/23/06 20:28

Hi,

I'm trying to get the following code to work:

$sql = 'SELECT name FROM ' . DB_TABLE_CITY . ' WHERE country_id = :countryId
AND name LIKE ":city%" LIMIT 10';
$sth = $dbh->prepare( $sql );
etc...

Using:

.... LIKE "' . $city . '%" ...

Works fine, but PDO doesn't seem to recognize the :city variable with the
trailing % sign. How can I make this work so PDO recognizes :city?

Thanks in advance!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация