change to SQL

This commit is contained in:
schrom01 2023-02-15 14:34:11 +01:00
parent 856d5a41db
commit 5642867c93
1 changed files with 1 additions and 1 deletions

View File

@ -30,7 +30,7 @@ function saveToDatabase($contentArray, $conn) {
echo "sending Query to Database<br>"; echo "sending Query to Database<br>";
$sql = "SELECT * FROM `topics` WHERE 1"; $sql = "SELECT * FROM `topics` WHERE 1";
// $result = $conn->query($sql); // $result = $conn->query($sql);
$result = 0; $result = 1;
echo "Select Query sent<br> Result: " . $result; echo "Select Query sent<br> Result: " . $result;
if($result === 0) { if($result === 0) {
$sql = "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]."'"; $sql = "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]."'";