麻烦帮我看看这段php代码哪里有问题,本地测试正常,但放到虚拟主机上后数据插入不到数据库。
数据库连接文件(真正的ip,用户名,密码被我替换了)<?php$conn=mysql_connect("123.456.789.000","username","pass...
数据库连接文件(真正的ip,用户名,密码被我替换了)
<?php
$conn = mysql_connect("123.456.789.000","username","password") or die ("数据库连接错误");
mysql_select_db("shop",$conn);
mysql_query("set names gb2312;");
?>
提交信息文件
<?php
include("conn.php");
$telephone = $_POST["telephone"];
$address = $_POST["address"];
$regtime = date("Y-m-d H:i:s");
if($_POST['submit']){
$sql = "INSERT INTO `table` (`telephone`, `address`, `regtime`)
VALUES ('$telephone', '$address', '$regtime')";
mysql_query($sql);
echo "提交成功!";
}
mysql_close();
exit();
?> 展开
<?php
$conn = mysql_connect("123.456.789.000","username","password") or die ("数据库连接错误");
mysql_select_db("shop",$conn);
mysql_query("set names gb2312;");
?>
提交信息文件
<?php
include("conn.php");
$telephone = $_POST["telephone"];
$address = $_POST["address"];
$regtime = date("Y-m-d H:i:s");
if($_POST['submit']){
$sql = "INSERT INTO `table` (`telephone`, `address`, `regtime`)
VALUES ('$telephone', '$address', '$regtime')";
mysql_query($sql);
echo "提交成功!";
}
mysql_close();
exit();
?> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询