change to SQL

This commit is contained in:
schrom01 2023-02-15 13:41:11 +01:00
parent 4d50ad03bf
commit 8251d3d97f
1 changed files with 3 additions and 1 deletions

View File

@ -24,7 +24,9 @@ $mysqli = new mysqli($databaseAddress, $databaseUser, $databasePassword, $databa
$mysqli = new mysqli($databaseAddress, $databaseUser, $databasePassword, $databaseName);
function saveToDatabase($contentArray, $mysqli) {
return $mysqli->query("INSERT INTO `topics` (`id`, `fullJSON`, `timeWatchM`,`timeWatchW`, `timeWatchD`, `countWatchM`, `countWatchW`, `countWatchD`) values ($contentArray[0], $contentArray[2], $contentArray[3], $contentArray[4], $contentArray[5], $contentArray[6], $contentArray[7], $contentArray[8]) ON DUPLICATE KEY UPDATE `id` = $contentArray[0]");
$response = $mysqli->query("INSERT INTO `topics` (`id`, `fullJSON`, `timeWatchM`,`timeWatchW`, `timeWatchD`, `countWatchM`, `countWatchW`, `countWatchD`) values ($contentArray[0], $contentArray[2], $contentArray[3], $contentArray[4], $contentArray[5], $contentArray[6], $contentArray[7], $contentArray[8]) ON DUPLICATE KEY UPDATE `id` = $contentArray[0]");
echo $response;
return $response;
}
function getFromDatabase() {