I have a table having the following fields: id(Autoincrement/Primary Key)/Integer1/Integer2/Sum/Product). I have filled integer1 and integer2 with the following code:
for ($i=1;$i<=1000;$i++)
{
$x2=rand(0,100);
$x3=rand(0,100);
$sql="INSERT INTO data(integer1,integer2) VALUES ($x2,$x3)";
$conn->query($sql);
}
I need help to prepare a function which uses MySQLFetch and computes sum of integer1 and integer2 and assigns the value in sum and product. I know it can be done using a simple loop, but would really like to get an understanding of fetching data.