summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2018-06-22 13:27:11 +0000
committerIan C <ianc@noddybox.co.uk>2018-06-22 13:27:11 +0000
commit840c543df8fa62a0417e53c632751f03185f17a4 (patch)
tree2001491cbd0cf5dd6be16accbb573caad20a759f
parent7964a8ba3dd041511c483b7f220b6d14d71ef69e (diff)
Fixed up data access pages.
-rw-r--r--www/add.php2
-rw-r--r--www/common.php4
-rw-r--r--www/edit.php4
3 files changed, 7 insertions, 3 deletions
diff --git a/www/add.php b/www/add.php
index d70fca9..fe21344 100644
--- a/www/add.php
+++ b/www/add.php
@@ -45,7 +45,7 @@ try
}
catch(PDOException $e)
{
- result["error"] = "DB error:" . $e->getMessage();
+ $result["error"] = "DB error:" . $e->getMessage();
}
header("Content-type:application/json");
diff --git a/www/common.php b/www/common.php
index 52971eb..a86d7b7 100644
--- a/www/common.php
+++ b/www/common.php
@@ -19,10 +19,14 @@
function ConnectDB()
{
+ global $config;
+
$pdo = new PDO("mysql:host=localhost;dbname={$config["dbname"]}",
$config["dbuser"], $config["dbpassword"]);
+
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
return $pdo;
}
+
?>
diff --git a/www/edit.php b/www/edit.php
index 1c61148..9e78e88 100644
--- a/www/edit.php
+++ b/www/edit.php
@@ -35,7 +35,7 @@ try
$cmd = $db->prepare("UPDATE pm_store " .
"set description=:description, " .
"username=:username, " .
- "password=:password) where id = :id");
+ "password=:password where id = :id");
$cmd->bindParam(":id", $id);
$cmd->bindParam(":description", $description);
$cmd->bindParam(":username", $username);
@@ -48,7 +48,7 @@ try
}
catch(PDOException $e)
{
- result["error"] = "DB error:" . $e->getMessage();
+ $result["error"] = "DB error:" . $e->getMessage();
}
header("Content-type:application/json");