簡體   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();
                    }
                }
            ?>

檢查您的產品表。 在該表中,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字段,或者其拼寫不同。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM