Check to see if the prep_statement is true.

This commit is contained in:
Mark Crane 2013-04-16 01:53:05 +00:00
parent f14500a40a
commit d0d7424447
2 changed files with 40 additions and 38 deletions

View File

@ -95,7 +95,7 @@ else {
$prep_statement = $db->prepare($sql);
if ($prep_statement) {
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$row = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
if ($row['num_rows'] > 0) {
$num_rows = $row['num_rows'];
}

View File

@ -91,6 +91,7 @@
}
$sql .= "limit $this->rows_per_page offset $this->offset ";
$prep_statement = $this->db->prepare(check_sql($sql));
if ($prep_statement) {
$prep_statement->execute();
$rows = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$this->count = count($rows);
@ -129,6 +130,7 @@
unset($rows);
}
unset ($prep_statement, $sql);
}
return $result;
}
}