Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

Commit

Permalink
Now handling the case where the first fetch fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
adamfranco committed Oct 17, 2011
1 parent b37fb4c commit 6bdcfe7
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions get.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@
$stmt->execute(array($id));
$row = $stmt->fetchObject();
}
$stmt = $db->prepare('UPDATE feeds SET last_access = NOW(), num_access = :num_access WHERE id = :id');
$stmt->execute(array(
':id' => $id,
':num_access' => $row->num_access + 1,
));

if ($row) {
$stmt = $db->prepare('UPDATE feeds SET last_access = NOW(), num_access = :num_access WHERE id = :id');
$stmt->execute(array(
':id' => $id,
':num_access' => $row->num_access + 1,
));
}

// If headers and data are null, then return an error
if (is_null($row->headers) && is_null($row->data)) {
if (!$row || is_null($row->headers) && is_null($row->data)) {
header('HTTP/1.1 500 Internal Server Error');
}
// Otherwise, return our content.
Expand Down

0 comments on commit 6bdcfe7

Please sign in to comment.