0

I am little stuck today trying to convert double quote into single quote.

I got this:

$string=" WHERE news_cat='$catid' AND news_title LIKE '%$searchnews%'";

I did this but it didn't work:

$string = ' WHERE `news_cat` = \'' . $catid . '\' AND `news_title` LIKE '%$searchnews%'';
Carey Gregory
  • 6,836
  • 2
  • 26
  • 47

1 Answers1

1

You also need to escape the last single quotes:

LIKE \'%'.$searchnews.'%\'';
Cyclonecode
  • 29,115
  • 11
  • 72
  • 93
  • 1
    Thanks a lot! I was very close but never thought of doing this one. lol – user2583893 Oct 05 '14 at 12:59
  • I wonder if you can help with this one here http://stackoverflow.com/questions/26161065/negative-value-error-in-limit-clause: This the whole file www.bestbuildpc.org/bugfiles/index.txt – user2583893 Oct 05 '14 at 13:17