change to SQL

This commit is contained in:
schrom01 2023-02-15 14:40:55 +01:00
parent ad99e62609
commit 90cf02939f
1 changed files with 3 additions and 2 deletions

View File

@ -28,10 +28,11 @@ if ($conn->connect_error) {
function saveToDatabase($contentArray, $conn) {
echo "sending Query to Database<br>";
$sql1 = "SELECT * FROM `topics` WHERE 1";
$sql1 = "SELECT * FROM `topics` WHERE id='".$contentArray[0]."'";
$result1 = $conn->query($sql1);
echo "Select Query sent<br>";
if(1 === 1) {
if(!mysql_num_rows($result1)) {
$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]."'";
$result = $conn->query($sql);
echo "Insert Query sent<br> Result: " . $result;