Reputation: 107
I'm scratching my head with this and i can't figure what's wrong
$result=mysql_query("SELECT *
FROM `offers`
WHERE
(
type='$tran' &&
imob='$typeimob' &&
(
'str_replace("_"," ",$zone)'
LIKE CONCAT('%',area,'%')
)
)
ORDER BY `price` DESC
LIMIT 0, 50;");
}
This is inside a php.
The problem is that I have to escape the double quotes inside str_replace, and i tried str_replace(\"_\",\" \",$zone)
but it doesn't work.
Any idea?
Thanks
Upvotes: 0
Views: 713
Reputation: 81
You need to concatenate the output of str_replace() into your string.
$result=mysql_query(
"SELECT *
FROM `offers`
WHERE
(
type='$tran' &&
imob='$typeimob' &&
(
'".str_replace("_"," ",$zone)."'
LIKE CONCAT('%',area,'%')
)
)
ORDER BY `price` DESC LIMIT 0, 50;");
By the way, if you are using an IDE like Eclipse PDT, these things will be apparent to you right away :)
Upvotes: 0