html表单提交到SQL数据库,但总显示PHP的代码,这怎么了? 5
一提交就出现这段PHP代码,这是代码哪错了?<?php$con=mysql_connect("localhost","1230200099","1230200099");...
一提交就出现这段PHP代码,这是代码哪错了?
<?php
$con = mysql_connect("localhost","1230200099","1230200099");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("1230200099", $con);
$sql="INSERT INTO login (username, password, email)
VALUES
('$_POST[username]','$_POST[password]','$_POST[email]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?> 展开
<?php
$con = mysql_connect("localhost","1230200099","1230200099");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("1230200099", $con);
$sql="INSERT INTO login (username, password, email)
VALUES
('$_POST[username]','$_POST[password]','$_POST[email]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询