Jump to content

Recommended Posts

i'm not getting any results for the query.  I'm sure it has something to do with the apostrophe and back slashes

$search = "q test'yes";
$search = mysql_real_escape_string($search);
mysql_query("SELECT * FROM block WHERE name LIKE '%$search%' ORDER BY `id` DESC",$this->connect);

 

When i echo it out i get this

SELECT * FROM block WHERE name LIKE '%q test\\\'yes%' ORDER BY `id` DESC

Link to comment
https://forums.phpfreaks.com/topic/242298-where-clause-like-and-apostrophe/
Share on other sites

when i echo my select query i now get this.

 

SELECT * FROM test WHERE name='q test\'1' ORDER BY `id` DESC LIMIT 10

 

in the database i have a row with name = q test\'1 but it isn't retrieving data.

 

What do i have to change to get the query to retrieve the result.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.