HELLO! 🙂
I require some help with my codes. The if query in the following codes does not work. Can anyone help me to identify where i went wrong?
THANKYOU!😉
$rthings = mysql_query('SELECT uid,itemid FROM inventory');
$things = mysql_fetch_assoc($rthings);
if ($_GET["operation"]==1){
$query = 'UPDATE Person SET wealth = wealth-5 WHERE uid = '.$uid;
mysql_query($query) or die(mysql_error());
if ($things['uid']==$uid $$ $things['itemid']==1){
$query = 'UPDATE inventory SET quantity = quantity+1 WHERE uid=".$uid." && itemid ="1" ';
mysql_query($query) or die(mysql_error());
echo "updated";
}else{
$query= 'INSERT INTO inventory (uid,itemid,quantity) VALUES ('.$uid.', 1, 1)';
mysql_query($query) or die(mysql_error());
echo "inserted";
}
Currently, only the insert into query works, thus whenever I press button with operation==1, there will be a new row inserted in our database table but the quantity is not updated