我的mysql_real_escape_string被忽略。这让我很难过,因为我觉得我错过了很小的东西。mysql_real_escape_string不工作
的$的htmlText变量来自哪里文本呈现为HTML即与标签等TinyMCE的编辑
<?php
/*--------GLOBAL PROCEDURES--------*/
session_start();
require "../scr/config-data.php.inc";
mysql_connect($host,$username,$password) or die
("Could Not Connect".mysql_error());
mysql_select_db($db) or die ("Could Not Connect".mysql_error());
/*-----SEVERAL SELECT/INSERT QUERIES, ALL WORKING FINE-----*/
/*--------SPECIFIC PROCEDURES-------*/
if($_POST['submit']){
//Check that POS has been chosen
$htmlText = mysql_real_escape_string($_POST['cust']);
if($htmlText != ""){
mysql_query("INSERT INTO table VALUES(NULL, '$htmlText')") or die(mysql_error());
}else{
$feedback = "Please Enter some text into the editor";
}
}
/*--------CLOSING PROCEDURES-------*/
mysql_close();
?>
奇怪的是,它是改编自这样的作品,只有改变变量的脚本名。我在MySQL语法中遇到错误。它也没有逃避文本中的HTML,所以我得到这个错误:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order VALUES(NULL, '
sfgafgafs
')' at line 1
什么错误信息,你得到什么例如输入? – Gumbo 2011-01-21 14:26:08
给出上述错误信息,但逃脱当特定领域应该是
sfgafgafs
,但它呈现为HTML – 2011-01-21 14:27:14您的表名为“订单”?尝试将其更改为``order``(反引号) – labue 2011-01-21 14:29:04