Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkmErssACgkQ7bkAtAithusj1ACdGrX3nZMeK+jQZjSbTEyxjiRP
gXEAoMD0Y/aZLq+jz5l/UON2YNMTGrFw
=vIE2
-----END PGP SIGNATURE-----
water wrote:
> I'm having a problem using quoting and a like statement with somehting
> like this:
...
> $sql="select id, headline, body from node where body like
> '%".$this->_db->quote($query)."%'";
...
> Is there a way to call quote without it putting the surrounding single
> quotes.
As someone has already mentioned, you can use:
$this->_db->quote('%' . $query . '%');
(i.e put the wildcards inside the value.
> This is actually a larger issue (and I'd probably consider a bug
> for things like 'select * from menu where id=23' where adding a set of
> single quotes around 23 adds time to query processing on MySQL.
If the value you are passing to be quotes is an integer (and not just a
string representing an integer), it won't have quotes added around it:
eg.
$this->_db->quote((int) $value);
--
Brenton Alker
没有评论:
发表评论