3
0
Fork 0
mirror of https://github.com/fsr/eseeva synced 2025-01-18 16:01:41 +01:00

minor fixes on databes interaction

This commit is contained in:
sjaster 2017-05-31 18:26:33 +02:00
parent 576d90f074
commit fd3233b5ca

View file

@ -59,7 +59,7 @@
$handle = new SQLite3($fileName);
if (!$handle)
return false;
$handle->exec("DROP TABLE answers;");
$handle->exec("DROP TABLE IF EXISTS answers;");
$handle->exec("CREATE TABLE IF NOT EXISTS 'answers'(KeyId text primary key,Status text,Student int,Answer);");
$keys = GenerateKeys($keyAmount);
$count = count($keys);
@ -216,7 +216,7 @@
return false;
//secure deleting by checking if key has been uesed already
$stmt = $handle->prepare("DELETE FROM answers WHERE KeyId=:keyid;");
$stmt = $handle->prepare("DELETE FROM answers WHERE KeyId=:keyid AND Answer IS NULL;");
if ($stmt)
{
$stmt->bindValue(':keyid', $key, SQLITE3_TEXT);