I got a table with one of the column have special charaters. I inserted to the table as
$sql=$wpdb->prepare(
"INSERT INTO `mytable`
( `question`, `remarks`)
VALUES ('%s', '%s' )",
array(sanitize_text_field($question),sanitize_text_field($remarks)) );
$wpdb->query($sql);
which in turn inserted a row like this
-------------------------------------------------|
| question | remarks |
-------------------------------------------------|
| \"creating world \" written by? | chom-lu |
| | |
-------------------------------------------------|
But When i try to SELECT
$quest='"creating world " written by?';
$sql=$wpdb->prepare("SELECT * FROM `mytable` WHERE
`question` LIKE '%s' AND `remarks` LIKE '%s'" ,
'%'.sanitize_text_field($quest).'%');
$result = $wpdb->get_results($sql);
return empty rows..
echo $sql; //reutrns as
SELECT * FROM `mytable` WHERE `question` LIKE '%\"creating world \" written by?%'
What i did wrong.. please help to find a way out of this problem.. this problem eating up my whole day from morning...
will you Speak in PHP... plezzzzzzzzze and IN GENERALIZED FORMAT