Commit 3ac2d9ba authored by Nico Schallehn's avatar Nico Schallehn

test

parent edefc12f
...@@ -207,33 +207,32 @@ class Media { ...@@ -207,33 +207,32 @@ class Media {
if (in_array($fsk2, array(0, 6, 12,16,18))){ if (in_array($fsk2, array(0, 6, 12,16,18))){
$fsk = $fsk2; $fsk = $fsk2;
$newData["fsk"] = $fsk2; $newData["fsk"] = $fsk2;
$fskbool = true;
}else{ }else{
echo $this->Console->error("keine fsk gefunden für imdbID ".$Film["imdbID"]."!").PHP_EOL; echo $this->Console->error("keine fsk gefunden für imdbID ".$Film["imdbID"]."!").PHP_EOL;
$fsk = ""; $fsk = "";
$counter++; $counter++;
} }
}else { }
$update =""; $update ="";
$first = true; $first = true;
foreach ($newData AS $key=> $value){ foreach ($newData AS $key=> $value){
if(!($Film[$key] == $newData[$key]) ) { if(!($Film[$key] == $newData[$key]) AND !($fskbool) ) {
$update .= " ".($first?"":",").$key." = '".$value."'"; $update .= " ".($first?"":",").$key." = '".$value."'";
$first = false; $first = false;
}
}
if(!$first){
$SQL = "UPDATE Filme SET".$update." WHERE imdbID = '".$Film["imdbID"]."';";
$mysqli->query($SQL);
file_put_contents("./phpTestout/update.txt", $SQL.PHP_EOL, FILE_APPEND);
echo $SQL.PHP_EOL;
}else {
echo "Nix zu ändern!".PHP_EOL;
} }
} }
if(!$first){
$SQL = "UPDATE Filme SET".$update." WHERE imdbID = '".$Film["imdbID"]."';";
$mysqli->query($SQL);
file_put_contents("./phpTestout/update.txt", $SQL.PHP_EOL, FILE_APPEND);
echo $SQL.PHP_EOL;
}else {
echo "Nix zu ändern!".PHP_EOL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment