开发者

Symfony, propel, question mark

开发者 https://www.devze.com 2023-01-30 03:31 出处:网络
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 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 *.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号