I want to do something as echo Integer but show it as decimal number..
In this case $rows[0] = 9
but I need to display it as 0.09 is that possible??
<?php
$con = new mysqli("localhost", "root", "") or die("not connected");
$mydb = mysqli_select_db($con, "ehh") or die("no db found");
if(!$con){
die('dont connect '. mysqli_connect_error());
}
if(!$mydb){
die('dont connect '. mysqli_connect_error());
}
$query = "SELECT COUNT(*) FROM ohh";
$result = mysqli_query($con,$query);
$rows = mysqli_fetch_row($result);
$yeah = $rows[0];
echo $yeah;
mysqli_close($con);
?>
In SQL
select ( count(*)/100.0 ) from ohh
Or in PHP (not both at the same time)
echo $yeah / 100;
Generic ( number with N digits )
$number = $rows[0];
$lenght = strlen($number);
$extra_decimals = 1;
$divisor = str_pad('1',$lenght + $extra_decimals ,'0',STR_PAD_RIGHT);
$result = $number / intval($divisor);
echo $result;