Skip to content

Instantly share code, notes, and snippets.

@sinamiandashti
Created December 13, 2017 09:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sinamiandashti/6f95e585956f356bfce709afecf24911 to your computer and use it in GitHub Desktop.
Save sinamiandashti/6f95e585956f356bfce709afecf24911 to your computer and use it in GitHub Desktop.
2 method of query in IPTV
<?php
$query = "SELECT SQL_CALC_FOUND_ROWS notifications.* FROM notifications WHERE";
if (!empty($filters['subsystem_id'])) {
$query .= " notifications.subsystem_id=:subsystem_id";
}
$stm = $this->db->prepare($query);
$stm->execute([':subsystem_id' => $filters['subsystem_id']]);
$data = [];
while ($row = $stm->fetch(\PDO::FETCH_ASSOC)) {
$data[] = $row;
}
return $data;
<?php
$notifics = DB::table('notifications');
if (!empty($filters['subsystem_id'])) {
$notifics->where('subsystem_id',$filters['subsystem_id']);
}
return $notifics->get();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment