SQL Like And Single Quotes

Started by mickjav, September 28, 2022, 02:44:33 PM

Previous topic - Next topic

mickjav

I have found while testing a search system, If I use a single quote with the below I get a error.

is there another way of doing the below so I can use single quotes

$record = $smcFunc['htmlspecialchars']($_REQUEST['search'],ENT_QUOTES);


switch ($_REQUEST['Search_by'])
{
case '1':
$searchby = ' LIKE "' . $record . '%"';
break;

default:
$searchby = ' LIKE "%' . $record . '%"';
break;
}

mick

Home of Chart Tracker Elite, Apollo & DJ 2020, Coming soon The Librarian.


mickjav


Home of Chart Tracker Elite, Apollo & DJ 2020, Coming soon The Librarian.

Advertisement: