Here is the problem. I want use php to store how many people choose mango as their favorite fruit.Here is the code:
mysql_select_db("assignment2", $con);
//$fruitresult = mysql_query("SELECT * FROM Persons");
if(strcasecmp("mango",$fruit)==0){
$fruitsql = mysql_query("SELECT Mango FROM assignment2.fruit");
$fruitresult= mysql_fetch_assoc($fruitsql);
$fruitresult['Mango']=(int)$fruitresult['Mango'];
$fruitresult['Mango']=$fruitresult['Mango']+1;
mysql_query(UPDATE assignment2.fruit SET Mango=".fruitresult['Mango']" WHERE fid=2);
echo"There are total ";
echo $fruitresult["Mango"];
echo " mango <br>";
//echo " testing work";
}
Before I add update query, it can get the number of mango and calculate it, but when I add update query, error occur:
Parse error: syntax error, unexpected 'assignment2' (T_STRING).
How can I fix it ?