Created
December 13, 2017 09:26
-
-
Save sinamiandashti/6f95e585956f356bfce709afecf24911 to your computer and use it in GitHub Desktop.
2 method of query in IPTV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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