简体   繁体   English

我在“字段列表”中收到此错误未知列“ 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();
                    }
                }
            ?>

Check your products table. 检查您的产品表。 In that table Retail_Price doesn't exit, so you are getting error. 在该表中,Retail_Price没有退出,因此您遇到了错误。

Remove id column and it null value, assumed it is integer value and is auto_increment 删除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字段,或者其拼写不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM