John Magnolia
John Magnolia

Reputation: 16823

zend db quote without quote so more like escape

I am trying to do something like this:

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

But this return: SELECT * FROM mytable WHERE url = ''test/'' OR url = ''test/'/'

I basically want the equivalent of mysql_real_escape_string for Zend.`

Upvotes: 0

Views: 166

Answers (1)

GautamD31
GautamD31

Reputation: 28773

Try with like like

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

Or even you can try like

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

Upvotes: 1

Related Questions