add ts to links table
This commit is contained in:
parent
bbf3da45e6
commit
5023235a2a
1 changed files with 4 additions and 2 deletions
|
@ -9,7 +9,8 @@ if (!$exists) {
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
url TEXT NOT NULL,
|
url TEXT NOT NULL,
|
||||||
audio BOOLEAN NOT NULL CHECK (audio IN (0, 1)),
|
audio BOOLEAN NOT NULL CHECK (audio IN (0, 1)),
|
||||||
video BOOLEAN NOT NULL CHECK (video IN (0, 1))
|
video BOOLEAN NOT NULL CHECK (video IN (0, 1)),
|
||||||
|
ts NUMBER
|
||||||
);
|
);
|
||||||
EOD);
|
EOD);
|
||||||
}
|
}
|
||||||
|
@ -22,10 +23,11 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
||||||
$video = $data->video;
|
$video = $data->video;
|
||||||
|
|
||||||
if ($url !== null && $audio !== null && $video !== null) {
|
if ($url !== null && $audio !== null && $video !== null) {
|
||||||
$stmt = $db->prepare('INSERT INTO links (url, audio, video) VALUES (:url, :audio, :video);');
|
$stmt = $db->prepare('INSERT INTO links (url, audio, video, ts) VALUES (:url, :audio, :video, :ts);');
|
||||||
$stmt->bindValue(':url', $url);
|
$stmt->bindValue(':url', $url);
|
||||||
$stmt->bindValue(':audio', $audio);
|
$stmt->bindValue(':audio', $audio);
|
||||||
$stmt->bindValue(':video', $video);
|
$stmt->bindValue(':video', $video);
|
||||||
|
$stmt->bindValue(':ts', time());
|
||||||
$result = $stmt->execute();
|
$result = $stmt->execute();
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
http_response_code(500);
|
http_response_code(500);
|
||||||
|
|
Loading…
Reference in a new issue