News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

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

Doug Heffernan

Quote from: mickjav on September 28, 2022, 02:44:33 PMIf I use a single quote with the below I get a error.

What error are you getting?

mickjav


Advertisement: