I have a SQL query that returns SUM, and I need to use that SUM later on to sum it to another field in PHP, so I could return the TotalSum (old points + new points) to the database, but I get the following error:
Object of class mysqli_result could not be converted to int
It doesn't add these values that I fetch from database.
My code is:
$Sum1= mysqli_query($con, "SELECT SUM(`Points`) FROM `table` WHERE `Id`=$ID ");
$Sum2= mysqli_query($con, "SELECT SUM(`PointsTwo`) FROM `table` WHERE `Id`=$ID");
$TotalSum=$Sum1+ $Sum2+ $NewPoints+ $NewPointsTwo;
I would like to point out that values in the columns are integers