Skip to content

Commit

Permalink
Add better error reporting to some functions. Set maximum width for u…
Browse files Browse the repository at this point in the history
…pdate text.
  • Loading branch information
Andy committed May 22, 2012
1 parent 1103a71 commit c885917
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions api.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ function delete_pet() {

if (!$result) {
header('HTTP/1.0 500');
$error = $query->errorInfo();
return json_encode($error);
}

return json_encode($result);
Expand All @@ -229,6 +231,8 @@ function add_update() {
return json_encode(false);
}

$value = stripslashes($value);

$dbh = new PDO($db_conn, $username, $pw);
$query = $dbh->prepare("insert into updates (date, value) values (:date, :value);");
$query->bindParam(":date", $date);
Expand All @@ -240,6 +244,8 @@ function add_update() {

if (!$result) {
header('HTTP/1.0 500');
$error = $query->errorInfo();
return json_encode($error);
}

$result = array(
Expand Down
1 change: 1 addition & 0 deletions minipetter.css
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ body.logged_in .box_buttons {

#last_update_value {
white-space: pre-line;
max-width: 500px;
}

#updater {
Expand Down

0 comments on commit c885917

Please sign in to comment.