![](/img/trans.png)
[英]Undefined index: retail_price displayed i couldn't pass retail_price in to loading_add.php page
[英]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.