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,755
  • 2
  • 24
  • 46

1 Answers1

1

You also need to escape the last single quotes:

LIKE \'%'.$searchnews.'%\'';
Cyclonecode
  • 27,619
  • 11
  • 71
  • 89