我得到一张表,其中一列有特殊字符。我在表格中插入为
$sql=$wpdb->prepare(
"INSERT INTO `mytable`
( `question`, `remarks`)
VALUES (\'%s\', \'%s\' )",
array(sanitize_text_field($question),sanitize_text_field($remarks)) );
$wpdb->query($sql);
然后又插入了这样一行
-------------------------------------------------|
| question | remarks |
-------------------------------------------------|
| \\"creating world \\" written by? | chom-lu |
| | |
-------------------------------------------------|
但当我尝试选择
$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);
返回空行。。
echo $sql; //reutrns as
SELECT * FROM `mytable` WHERE `question` LIKE \'%\\"creating world \\" written by?%\'
我做错了什么。。请帮助找到解决此问题的方法。。这个问题从早上就把我的一整天都耗光了。。。
will you Speak in PHP... plezzzzzzzzze and IN GENERALIZED FORMAT