if(isset($_POST['job']) && $_POST['job']=="edit"){
//$MySql_update=addslashes($MySql_update);
$MySql_update="update hotel_activities_2 set hotel_id='".$_POST['hotel_id']."',start_date='".$_POST['start_date']."',end_date='".$_POST['end_date']."',content='".$_POST['content']."',source='".$_POST['source']."',s_type='".$_POST['s_type']."' where h_id=".$_POST['hid'];
$result=mysql_query($MySql_update);
//$MySql_update=addslashes($MySql_update);
$MySql_update="update hotel_activities_2 set hotel_id='".$_POST['hotel_id']."',start_date='".$_POST['start_date']."',end_date='".$_POST['end_date']."',content='".$_POST['content']."',source='".$_POST['source']."',s_type='".$_POST['s_type']."' where h_id=".$_POST['hid'];
$result=mysql_query($MySql_update);
$result=mysql_query($MySql_update);
给$_POST['hotel_id']这些变量用的
太麻烦了,还有没有更方便的
转义下列
\x00
\n
\r
\
'
"
\x1a
你输出你的sql语句看下为什么不行
用addslashes也不用每个都加 直接一个循环就可以搞定
如果你能确认不存在 SQL 注入的危险,那么做起来还是很简单的if( ! get_magic_quotes_gpc() ) { //检查是否启用了自动外部数据转义
set_magic_quotes_runtime(1); //若没有,则启用传入数据库数据自动转义
}
$MySql_update="update ...... ";