zend db引用没有引用所以更像是逃避

时间:2013-11-07 10:49:54

标签: php zend-framework

我正在尝试做这样的事情:

$url = 'test/';
$url = rtrim($url, "'");
$url = $db->quote($url);
$sql = "SELECT * FROM mytable WHERE url = '{$url}' OR url = '{$url}/'";

但是这个回复:SELECT * FROM mytable WHERE url ='' test /''或者url ='' test /' /'

我基本上想要Zend的等效mysql_real_escape_string。

1 个答案:

答案 0 :(得分:1)

尝试like喜欢

$sql = "SELECT * FROM mytable WHERE url LIKE '%{$url}/%'";

甚至你可以试试

$url = 'test/';
$sql = "SELECT * FROM mytable WHERE url LIKE '%{$url}%'";