apostrophe like and equal clause not working

痞子三分冷 提交于 2019-12-04 19:41:56

If you want to search for limit's, you have to have limit's in your table.
So, first of all get rid of the erroneous backslash in the table entry.

The rest is as usual

$tag = $db->getOne('SELECT id FROM tags WHERE name = ?s', $adTag);

Well after so many googleing work done i finally get this working.

below is the solution for me.

SELECT *
FROM tags
WHERE `name` = 'limit\\''s'
LIMIT 0 , 30

Its worked like charm. Hope this will help in future for other geeks.

I tried recreating your db and searching, it needs 2 addslashes to appear on the results. I think MySQL escapes the first slash automatically.

addslashes(addslashes($adTag));

Try this..

$sql = "SELECT id FROM tags AS Tag WHERE name LIKE %". mysql_real_escape_string( stripslashes(urldecode($adTag))) ."% LIMIT 0,1
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!