sql="insert into gd_stock(Stock_Purchase) values("$a['Quantity']") where Product_Model="$a['Model_No']"";
Here is shows the error :Parse error: syntax error, unexpected '='!
sql="insert into gd_stock(Stock_Purchase) values("$a['Quantity']") where Product_Model="$a['Model_No']"";
Here is shows the error :Parse error: syntax error, unexpected '='!
Insert statements doesn't use a where clause except you want to insert into from another table conditionally which will first of all select from the table before inserting if not so your sql should be like this
sql="insert into gd_stock(Stock_Purchase) values('".
$a['Quantity']. "')";
$sql="insert into gd_stock(Stock_Purchase) values("$a['Quantity']") where
Product_Model=".$a['Model_No'];
if (!mysqli_query($con, $sql))
{
echo("Error description: " . mysqli_error($con));
}
sql="insert into gd_stock(Stock_Purchase) values('{$a['Quantity']}') where Product_Model='{$a['Model_No']}'";
{} to warp your variables in stringUSE $ symbol to define $sql.
$sql="insert into gd_stock(Stock_Purchase) values('{$a['Quantity']}') where
Product_Model='{$a['Model_No']}'";;
Try this
$sql="insert into gd_stock(Stock_Purchase) values(". $a['Quantity']. ") where Product_Model=". $a['Model_No']. "";
You did not concatenate (join) the string with the variable
$dbconn - for your Mysql Database Connection
$insertsql="insert into gd_stock(Stock_Purchase) values("$a['Quantity']") where Product_Model=".$a['Model_No'];
if (!mysql_query($dbconn, $insertsql))
{
echo("Error Details: " . mysql_error($con));
}
You need to escape your inner quotation marks.
try this:
$sql="insert into gd_stock(Stock_Purchase) values("$a['Quantity']") where Product_Model=\""$a['Model_No']"\"";