打印sql语句没问题,但是打印$success 就显示空白,是不是没有连接上数据库?
$sql="INSERT INTO order(name,nationality,hotel_name,hotel_stars,room_type,check_in_date,check_out_date,special_needs,order_re1,order_re2,order_re3)VALUES('$name','$nationality','$hotel_name','$hotel_stars','$room_type','$check_in_date','$check_out_date','$special_needs','$order_re1','$order_re2','$order_re3')";
//echo $sql;return;
$success=mysql_query($sql);//增加数据
//echo $success;return;
if($success!==false){
echo "<script>alert('酒店预订成功,请注意查收消息');</script>";
}else{
echo "<script>alert('对不起酒店预订失败,请重新预订');window.history.back();</script>";
exit;
}
$sql="INSERT INTO order(name,nationality,hotel_name,hotel_stars,room_type,check_in_date,check_out_date,special_needs,order_re1,order_re2,order_re3)VALUES('$name','$nationality','$hotel_name','$hotel_stars','$room_type','$check_in_date','$check_out_date','$special_needs','$order_re1','$order_re2','$order_re3')";
//echo $sql;return;
$success=mysql_query($sql);//增加数据
//echo $success;return;
if($success!==false){
echo "<script>alert('酒店预订成功,请注意查收消息');</script>";
}else{
echo "<script>alert('对不起酒店预订失败,请重新预订');window.history.back();</script>";
exit;
}
$linksql=mysql_connect("127.0.0.1:3306","root","123");
mysql_select_db("testweb",$linksql);
mysql_query("SET NAMES 'utf8'");
?>
mysql_connect() or die('aaaaaaaaaaa');
检查是否执行成功
echo mysql_insert_id();
sql语句都看不见
$linksql=mysql_connect("127.0.0.1:3306","root","123") or die('没连接上mysql!');$sql打出来看看,看不见全部,你看看你sql语句中是不是有的字段类型不符合数据库类型啊