[embed_custom_field “code1”]
[insert_php]
if(isset($_POST[‘existing_light_wattage’]) && isset($_POST[‘led_wattage’]) && isset($_POST[‘existing_bulbs’]) && isset($_POST[‘unit_charged’]) ) {
if(!empty($_POST[‘existing_light_wattage’]) && !empty($_POST[‘led_wattage’]) && !empty($_POST[‘existing_bulbs’]) && !empty($_POST[‘unit_charged’])) {
$servername = ‘localhost’;
$username = ‘solarman_cal’;
$password = ‘mv)f848R4h~&’;
$dbname = ‘solarman_tools’;
// Create connection
$conn = mysql_connect($servername, $username, $password) or die(“Unable to connect to MySQL”);
mysql_select_db($dbname, $conn );
$i=$_POST[‘existing_light_wattage’];
$j=$_POST[‘led_wattage’];
$b=$_POST[‘existing_bulbs’];
$ll = $_POST[‘unit_charged’];
$ip = $_SERVER[‘REMOTE_ADDR’];
$date= date(‘Y-m-d’);
$sql = “INSERT INTO `energy_saving` (`existing_light_wattage`, `led_wattage`, `existing_bulbs`, `date`, `ip`) VALUES (‘$i’,’$j’,’$b’,’$date’, ‘$ip’)”;
if (mysql_query($sql) === TRUE) {
} else {
echo “Error: ” .mysql_error() . “
“;
}
mysql_close($conn);
$r=((($i-$j)*25000)/1000);
$n=$b*$r;
$lll = $ll*$n;
echo “
| Existing lights’ Wattage | “; echo number_format($i);echo” W |
| LED Wattage | “; echo number_format($j);echo” W |
| No. of lights to be replaced | “; echo number_format($b);echo ” nos |
Result:
|
Energy savings from using 1 LED over its entire lifetime is |
“; echo number_format($r); echo” units |
|
Energy saving from using $b LED(s) over its entire lifetime is |
“; echo number_format($n); echo” units |
|
Monetary savings from replacing $b lights with LEDs over its entire lifetime – |
Rs.$lll |
Assumptions
- Lifetime of an LED bulb is approximated to be 25000 hours
- Here the replacement cost of lights is not considered. The actual savings would be higher if it was considered.
Looking to own customized calculators?
Talk to ramya@solarmango.com
} else {
echo “
To view results, please fill all the fields correctly
}
}[/insert_php]
