Symfony, propel, question mark
I want to create a search function on my website, and I don't want to use a plugin for this thing, because it's very simple, but I can't solve this problem:
I give the keyword to the model which creates a query, but I couldn't figure out how to put joker characters in t开发者_开发知识库his query.
I'm using Propel
Dennis
The filterByXXX()
query functions will use LIKE
when your query contains wildcards:
$books = BookQuery::create()
->filterByTitle('War%')
->find();
// example Query generated for a MySQL database
$query = 'SELECT book.* from `book` WHERE book.TITLE LIKE :p1'; // :p1 => 'War%'
Remember, the wildcards you can use in SQL are _
for exactly one and %
for zero or more characters. So not ?
or *
.
精彩评论