duankekan9269 2015-12-23 08:50
浏览 17
已采纳

我不知道我的HTML和PHP代码有什么问题。它给出错误:查询为空

<body>

<h1><center>PHARMA DEVELOPMENT</center></h1>
<form name="reg" action="insert.php"  method="post">
<table width="274" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td width="95"><div align="right">username:</div></td>
<td width="171"><input type="text" name="phpro_username" /></td>
</tr>
<tr>
<td><div align="right">Password:</div></td>
<td><input type="text" name="phpro_password" /></td>
</tr>
<tr>
<td><div align="right">city:</div></td>
<td><input type="text" name="city" /></td>
</tr>
<tr>
<td><div align="right">state:</div></td>
<td><input type="text" name="state" /></td>
</tr>
<tr>
<td><div align="right">Country.:</div></td>
<td><input type="text" name="country" /></td>
</tr>
<tr>
<td><div align="right"></div></td>
<td><input name="submit" type="submit" value="Submit" /></td>
</tr>
</table>
</form>      
</body>


insert.php `<?php`

$con = mysql_connect("localhost","uai","dev@123");
if (!$con)
{

die('Could not connect: ' . mysql_error());
}
mysql_select_db("reference", $con);

$username =$_POST['phpro_username'];
$password =$_POST['phpro_password'];
$city =$_POST['city'];
$state =$_POST['state'];
$country =$_POST['country'];
$result = mysql_query("INSERT INTO phpro_salsrep(phpro_username, phpro_password, city, state, country) VALUES('$username','$password','$city','$state','$country')");
if (!mysql_query($result,$con))
{
echo "inserted sucessfully";
}
else
{
die('Error:' .mysql_error());
}
mysqli_close($con);
?>
  • 写回答

1条回答 默认 最新

  • ds78662302 2015-12-23 08:53
    关注

    Your <body> tag is within your <head> tag.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源