error: can't write on $FileName
";
fclose($file);
return false;
}
}
else
{
//print "error: can't open $FileName
";
return false;
}
}
function CreateFilm($title, $details)
{
LoadFromJson();
$array=$GLOBALS['ArrayFakeDB'];
$array[$title]=$details;
$GLOBALS['ArrayFakeDB']=$array;
SaveToJson();
}
function ReadAllFilms()
{
LoadFromJson();
return $GLOBALS['ArrayFakeDB'];
}
function UpdateFilm($old_title, $title, $details)
{
DeleteFilm($old_title);
CreateFilm($title, $details);
}
function DeleteFilm($title)
{
LoadFromJson();
$array=$GLOBALS['ArrayFakeDB'];
unset($array[$title]);
$GLOBALS['ArrayFakeDB']=$array;
SaveToJson();
}
?>