I want $userhp1 to print to screen, and also save to the allocated sql table. This works fine, but they are both returning different results. Is there anyway to make them return the same value?
ob_start();
vitality(); //runs vitality function
$uservit = ob_get_contents(); // stores result on $uservit
ob_end_clean();
echo "-Vitality:";
echo "$uservit<br />";// Prints vitality
$userhp1 = $uservit * 2.8; // multiplys vitality too create HP
$userhp2 = $userhp1;
echo "-HP From vit:";
echo "$userhp2"; // prints hp
$con=mysqli_connect("localhost", "***", "***", "***");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
mysqli_query($con,"UPDATE users SET hp=$userhp2
WHERE id='1'");
mysqli_close($con);
$userhp2really contains a numerical value...