表单传数据到php,为什么表单插入int型报错,换成varchar没报错但数据库没数据 5
//Createtableinmy_dbdatabasemysql_select_db("me_db",$con);$sql="CREATETABLEPersons(Na...
// Create table in my_db database
mysql_select_db("me_db", $con);
$sql = "CREATE TABLE Persons
(
Name varchar(15),
Tel varchar(15),
People varchar(15),
Message varchar(55)
)";
mysql_query($sql,$con);
//insert
mysql_select_db("me_db", $con);
$sql="INSERT INTO Persons (Name, Tel, People, Message)
VALUES
('$_POST[name]','$_POST[tel]','$_POST[people]','$_POST[message]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added"; 展开
mysql_select_db("me_db", $con);
$sql = "CREATE TABLE Persons
(
Name varchar(15),
Tel varchar(15),
People varchar(15),
Message varchar(55)
)";
mysql_query($sql,$con);
//insert
mysql_select_db("me_db", $con);
$sql="INSERT INTO Persons (Name, Tel, People, Message)
VALUES
('$_POST[name]','$_POST[tel]','$_POST[people]','$_POST[message]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added"; 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询