[wd_asp elements=’search’ ratio=’100%’ id=1]

Divide by zero errors

28th May 2014

Php - Maths

php codehaven

always do a pre-check to see if the variable contains only a zero, then either make 2 decimal places, (as this may prevent it fitting into the field space given, or round the number after.
This will make it two decimal places
if ($myconversions == 0 ) {
$databasevar= sprintf("%1.2f",$databasevar);
}