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.

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

报告相同问题?

悬赏问题

  • ¥20 搭建pt1000三线制高精度测温电路
  • ¥15 使用Jdk8自带的算法,和Jdk11自带的加密结果会一样吗,不一样的话有什么解决方案,Jdk不能升级的情况
  • ¥15 画两个图 python或R
  • ¥15 在线请求openmv与pixhawk 实现实时目标跟踪的具体通讯方法
  • ¥15 八路抢答器设计出现故障
  • ¥15 opencv 无法读取视频
  • ¥15 按键修改电子时钟,C51单片机
  • ¥60 Java中实现如何实现张量类,并用于图像处理(不运用其他科学计算库和图像处理库))
  • ¥20 5037端口被adb自己占了
  • ¥15 python:excel数据写入多个对应word文档