我在“字段列表”中收到此错误未知列“Retail_Price”


I got this error Unknown column 'Retail_Price' in 'field list'

        <?php           
                if(isset($_POST['insert']))
                {
                    echo $insert="insert into products (id,Product,Form,Strength,Generic_Name,Pack_Size,Retail_Price,Trade_Price) values
        ('','".$_POST['Product']."','".$_POST['Form']."','".$_POST['Strength']."','".$_POST['Generic_Name']."','".$_POST['Pack_Size']."','".$_POST['Retail_Price']."','".$_POST['Trade_Price']."')";
                    $query_insert=mysql_query($insert);
                    if($query_insert)
                    {
                        $msg2="Inserted Successfully" or die(mysql_error());
                    }
                    else
                    {
                        $msg2="Product already exist";
                        echo mysql_error();
                    }
                }
            ?>

检查您的产品表。在该表中,Retail_Price不会退出,因此您会收到错误。

删除id列,它null值,假设它是整数值并且是auto_increment

    <?php 
                if(isset($_POST['insert']))
                {
                    echo $insert="insert into products (Product,Form,Strength,Generic_Name,Pack_Size,Retail_Price,Trade_Price) values
        ('".$_POST['Product']."','".$_POST['Form']."','".$_POST['Strength']."','".$_POST['Generic_Name']."','".$_POST['Pack_Size']."','".$_POST['Retail_Price']."','".$_POST['Trade_Price']."')";
                    $query_insert=mysql_query($insert);
                    if($query_insert)
                    {
                        $msg2="Inserted Successfully" or die(mysql_error());
                    }
                    else
                    {
                        $msg2="Product already exist";
                        echo mysql_error();
                    }
                }
            ?>

产品表中不存在字段Retail_Price,或者拼写不同。