I can not change the time zone in the index.php file
In this file I have all the functions, checks, SQL requests.
I’m setting the team up
date_default_timezone_set (‘Europe / Samara’);
$ date = date (“Y-m-d G: i: s”);
and I write the query:
and I have server time displayed, -4 hours for me. If I register NOW () -> ‘$ date’ together, then the date is displayed in the database as 0000-00-00 00:00:00. I can not understand why this is so? In separate files such as chat and registration, the function $ date is also registered and in the SQL query it is ‘$ date’ instead of NOW () and everything displays correctly. Why does index.php not work?
function SendNotice($p1, $p2) {
global $CONNECT;
$Row = mysqli_fetch_assoc(mysqli_query($CONNECT, “SELECT id FROM users WHERE login = ‘$p1’”));
if (!$Row[‘id’]) echo ‘Error’;
mysqli_query($CONNECT, “INSERT INTO notice VALUES (’’, ‘$Row[id]’, 0, ‘$date’, ‘$p2’)”);
}
date is displayed as 00000000
date_default_timezone_set (‘Europe / Samara’);
$ date = date (“Y-m-d G: i: s”);
works if I am on any page of my site, such as profile, login, news. On these pages, the date is displayed correctly. But in the file I’m trying to write the date, it’s not a public page that you can go to. This is a page with all the functionality, the pages that I connect to the site, connecting the database. This file is a single entry point.