From 62d926e022aaf35be029f20568e55533caee3bf7 Mon Sep 17 00:00:00 2001 From: Ian C Date: Sat, 7 Jul 2018 13:26:02 +0000 Subject: Added up/down links to reorder entries. --- www/add.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'www/add.php') diff --git a/www/add.php b/www/add.php index 7b9d99f..e5c1a18 100644 --- a/www/add.php +++ b/www/add.php @@ -34,7 +34,7 @@ try $cmd = $db->prepare("INSERT INTO pm_store " . "(description, groupname, username, password) ". - "values " . + "VALUES " . "(:description, :group, :username, :password)"); $cmd->bindParam(":description", $description); $cmd->bindParam(":group", $group); @@ -42,7 +42,13 @@ try $cmd->bindParam(":password", $password); $cmd->execute(); - $result["id"] = $db->lastInsertId(); + $id = $db->lastInsertId(); + + $result["id"] = $id; + + $update = $db->prepare("UPDATE pm_store SET display = :id WHERE id = :id"); + $update->bindParam(":id", $id); + $update->execute(); $db = null; } -- cgit v1.2.3