I am trying to fetch some data from MySQL which contain single quotes through dependent select in Ajax but it wasn't returning any results.
I used
$mysqli->real_escape_string
That doesn't help either.
In my database table, I have values which are like this:
OTUN 'A', JAGUN B'. Using dependent select menu, I need to fetch places under each of them.
My query:
$ward_code = $mysqli->real_escape_string($_REQUEST['ward_code']);
$sql = "select pu_name, concat(pu_code,' - ',pu_name) pu_name from polling_unit where REPLACE(pu_ward_name,'\\\\','')='".$ward_code."'
AND pu_name NOT IN (SELECT pu_name FROM post_election_info ) order by CAST(pu_code AS UNSIGNED)";