我正在尝试做这样的事情:
$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。
答案 0 :(得分:1)
尝试like
喜欢
$sql = "SELECT * FROM mytable WHERE url LIKE '%{$url}/%'";
甚至你可以试试
$url = 'test/';
$sql = "SELECT * FROM mytable WHERE url LIKE '%{$url}%'";