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 2d9cb53435
commit a354961b3e
2 changed files with 40 additions and 38 deletions
@@ -94,8 +94,8 @@ else {
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$prep_statement = $db->prepare($sql); $prep_statement = $db->prepare($sql);
if ($prep_statement) { if ($prep_statement) {
$prep_statement->execute(); $prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC); $row = $prep_statement->fetchAll(PDO::FETCH_ASSOC);
if ($row['num_rows'] > 0) { if ($row['num_rows'] > 0) {
$num_rows = $row['num_rows']; $num_rows = $row['num_rows'];
} }
@@ -91,44 +91,46 @@
} }
$sql .= "limit $this->rows_per_page offset $this->offset "; $sql .= "limit $this->rows_per_page offset $this->offset ";
$prep_statement = $this->db->prepare(check_sql($sql)); $prep_statement = $this->db->prepare(check_sql($sql));
$prep_statement->execute(); if ($prep_statement) {
$rows = $prep_statement->fetchAll(PDO::FETCH_NAMED); $prep_statement->execute();
$this->count = count($rows); $rows = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if ($this->count > 0) { $this->count = count($rows);
$x = 0; if ($this->count > 0) {
foreach($rows as $row) { $x = 0;
//increment the array index foreach($rows as $row) {
if (isset($previous) && $row["conference_room_uuid"] != $previous) { $x++; } //increment the array index
//build the array if (isset($previous) && $row["conference_room_uuid"] != $previous) { $x++; }
$result[$x]["domain_uuid"] = $row["domain_uuid"]; //build the array
$result[$x]["conference_room_uuid"] = $row["conference_room_uuid"]; $result[$x]["domain_uuid"] = $row["domain_uuid"];
$result[$x]["conference_center_uuid"] = $row["conference_center_uuid"]; $result[$x]["conference_room_uuid"] = $row["conference_room_uuid"];
$result[$x]["meeting_uuid"] = $row["meeting_uuid"]; $result[$x]["conference_center_uuid"] = $row["conference_center_uuid"];
$result[$x]["max_members"] = $row["max_members"]; $result[$x]["meeting_uuid"] = $row["meeting_uuid"];
$result[$x]["wait_mod"] = $row["wait_mod"]; $result[$x]["max_members"] = $row["max_members"];
$result[$x]["announce"] = $row["announce"]; $result[$x]["wait_mod"] = $row["wait_mod"];
$result[$x]["mute"] = $row["mute"]; $result[$x]["announce"] = $row["announce"];
$result[$x]["record"] = $row["record"]; $result[$x]["mute"] = $row["mute"];
$result[$x]["sounds"] = $row["sounds"]; $result[$x]["record"] = $row["record"];
$result[$x]["profile"] = $row["profile"]; $result[$x]["sounds"] = $row["sounds"];
$result[$x]["meeting_user_uuid"] = $row["meeting_user_uuid"]; $result[$x]["profile"] = $row["profile"];
$result[$x]["user_uuid"] = $row["user_uuid"]; $result[$x]["meeting_user_uuid"] = $row["meeting_user_uuid"];
if ($row["member_type"] == "moderator") { $result[$x]["user_uuid"] = $row["user_uuid"];
$result[$x]["moderator_pin"] = $row["member_pin"]; if ($row["member_type"] == "moderator") {
} $result[$x]["moderator_pin"] = $row["member_pin"];
if ($row["member_type"] == "participant") { }
$result[$x]["participant_pin"] = $row["member_pin"]; if ($row["member_type"] == "participant") {
} $result[$x]["participant_pin"] = $row["member_pin"];
$result[$x]["created"] = $row["created"]; }
$result[$x]["created_by"] = $row["created_by"]; $result[$x]["created"] = $row["created"];
$result[$x]["enabled"] = $row["enabled"]; $result[$x]["created_by"] = $row["created_by"];
$result[$x]["description"] = $row["description"]; $result[$x]["enabled"] = $row["enabled"];
//set the previous uuid $result[$x]["description"] = $row["description"];
$previous = $row["conference_room_uuid"]; //set the previous uuid
$previous = $row["conference_room_uuid"];
}
unset($rows);
} }
unset($rows); unset ($prep_statement, $sql);
} }
unset ($prep_statement, $sql);
return $result; return $result;
} }
} }