Php 提交表单不会将数据提交到数据库

Php 提交表单不会将数据提交到数据库,php,mysql,submit,Php,Mysql,Submit,我整晚都在努力完成这件事,但一点运气都没有。出于某种原因,表单会提交,但数据不会发送到数据库。 这是PHP部分 <?php mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); if ( isset ( $_POST['Submit'] ) ) //If submit is hit

我整晚都在努力完成这件事,但一点运气都没有。出于某种原因,表单会提交,但数据不会发送到数据库。 这是PHP部分

<?php 

mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");
if ( isset ( $_POST['Submit'] ) ) //If submit is hit
{
   $name = $_POST['name'];  
   $category = $_POST['category'];  
   $class = $_POST['class'];  
   $level = $_POST['level'];  
   $bind = $_POST['bind'];  
   $tier = $_POST['tier'];  
   $trade = $_POST['trade'];  
   $ilvl = $_POST['ilvl'];  
   $amod = $_POST['amod'];  
   $xdmg = $_POST['xdmg'];  
   $description = $_POST['description'];  
   $description2 = $_POST['description2'];  
   $description3 = $_POST['description3'];  
   $sprice = $_POST['sprice'];  
   $bprice = $_POST['bprice'];  
   $percent = $_POST['percent'];  
   $source = $_POST['source'];  
   $tnail = $_POST['tnail'];  
   $result=MYSQL_QUERY("INSERT INTO items (name, category, class, level, bind, tier, trade, ilvl, amod, xdmg, description, description2, description3, sprice, bprice, percent, source, tnail)".
   "VALUES ( '$name', '$category', '$class', '$level', '$bind', '$tier', '$trade', '$ilvl', '$amod', '$xdmg', '$description', '$description2', '$description3', '$sprice', '$bprice', '$percent', '$source', '$tnail' )")or die( "<p><span style=\"color: red;\">Unable to select table</span></p>");
   mysql_close();
   //confirm
   echo "<p><span style=\"color: red;\">Thank You; the items have been entered in the database. DO NOT REFRESH THE PAGE or data will be sent again.</span></p>"; 
}
else
{
   // close php so we can put in our code
?>

尝试关闭字段名,如(`name`、`category`……等。

尝试关闭字段名,如(`name`、`category`……等。

调用
mysql\u query()
后,将以下代码放在任意位置


它将显示您的查询或数据库凭据是否有问题。

在调用
mysql\u query()
后,将以下代码放在任意位置


它将显示您的查询或数据库凭据是否有任何问题。

Wow,从未听说过SQL注入?您的“MYSQL\u查询”是否全部用大写字母?@WaynnLue无所谓。这是一个混乱。隔离具体问题并提交一个更为集中的问题。
MYSQL\u错误()
show?哇,从来没有听说过SQL注入?你的“MYSQL\u查询”都是大写的吗?@WaynnLue这没关系。这是一团乱麻。隔离具体问题并提交一个更集中的问题。
MYSQL\u error()
show是什么?
echo mysql_error();