change to SQL

This commit is contained in:
schrom01 2023-02-15 13:59:59 +01:00
parent f66bfa7d51
commit 6ef5a86477
1 changed files with 2 additions and 1 deletions

View File

@ -28,7 +28,8 @@ if ($conn->connect_error) {
function saveToDatabase($contentArray, $conn) { function saveToDatabase($contentArray, $conn) {
echo "sending Query to Database<br>"; echo "sending Query to Database<br>";
$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]";
$sql = "INSERT INTO `topics` (`id`) values ('test')";
$result = $conn->query($sql); $result = $conn->query($sql);
echo "Query sent<br>"; echo "Query sent<br>";
echo $result; echo $result;