mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-25 20:08:23 +02:00
Further PostgreSQL compatibility
This commit is contained in:
parent
5dc5160f8e
commit
bc8f904c3a
4 changed files with 63 additions and 63 deletions
|
@ -15,18 +15,18 @@ try {
|
|||
|
||||
try {
|
||||
// Check if there's an entry for the current date
|
||||
$query = "SELECT `id` FROM `statistics` WHERE `date` = CURDATE()";
|
||||
$query = "SELECT id FROM statistics WHERE date = CURDATE()";
|
||||
$curdate_id = $dbh->query($query)->fetchColumn();
|
||||
|
||||
if (!$curdate_id) {
|
||||
$dbh->exec("INSERT IGNORE INTO `statistics` (`date`) VALUES(CURDATE())");
|
||||
$dbh->exec("INSERT IGNORE INTO statistics (date) VALUES(CURDATE())");
|
||||
}
|
||||
|
||||
// Get the total number of domains
|
||||
$total_domains = $dbh->query("SELECT COUNT(`id`) AS `total_domains` FROM `domain`")->fetchColumn();
|
||||
$total_domains = $dbh->query("SELECT COUNT(id) AS total_domains FROM domain")->fetchColumn();
|
||||
|
||||
// Update the statistics table with the total number of domains for the current date
|
||||
$dbh->exec("UPDATE `statistics` SET `total_domains` = '$total_domains' WHERE `date` = CURDATE()");
|
||||
$dbh->exec("UPDATE statistics SET total_domains = '$total_domains' WHERE date = CURDATE()");
|
||||
|
||||
} catch (PDOException $e) {
|
||||
// Handle database errors
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue