<?php
$servername = "localhost";
$username = "xxx";
$password = "xxx";
$dbname = "energy";
date_default_timezone_set("Europe/Sofia");
$h = date('H');
$m = date('i');
$month = date('n');
//$year = date('Y');
// Create connection
// $conn = mysqli_connect($servername, $username, $password, $dbname);
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
switch ($month) {
case 12: {
if ($h >= 06 && $m >= 00) {
$sql = "INSERT INTO test2 (resultat, current )
VALUES (100 , 50)";
}
}
break;
}
$result = $conn->query($sql);
if ($result == true) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
$servername = "localhost";
$username = "xxx";
$password = "xxx";
$dbname = "energy";
date_default_timezone_set("Europe/Sofia");
$h = date('H');
$m = date('i');
$month = date('n');
//$year = date('Y');
// Create connection
// $conn = mysqli_connect($servername, $username, $password, $dbname);
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
switch ($month) {
case 12: {
if ($h >= 06 && $m >= 00) {
$sql = "INSERT INTO test2 (resultat, current )
VALUES (100 , 50)";
}
}
break;
}
$result = $conn->query($sql);
if ($result == true) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>