public function get_profile($id) { $sql = "SELECT * FROM profile WHERE profile_id = " . $id . " LIMIT 1;"; $result = parent::query($sql, $rows, $num_rows); if ($result) { return $rows[0]; } }
private function set_last_login() { $sql = 'UPDATE admin SET last_login = NOW() WHERE id = ' . $this->id; $res = parent::query($sql, $rows, $num_rows, $last_id); if ($res) { return true; } return false; }
public function get_district($id) { $sql = "select * from district where DISTRICT_ID = " . $id . ";"; $result = parent::query($sql, $rows, $num_rows); if ($result) { return $rows; } else { echo $result; } }
public function get_report($stmt) { if ($stmt == 'work or study report') { $sql = 'select * from research where do_present = "working";'; $res = parent::query($sql, $rows, $num_rows); if ($res) { print 'Rows: ' . $num_rows; } else { print $res; } } else { } }
<div class="panel-body"> <table class="table table-hover"> <tr> <th>ความชำนาญการ</th> <th>สร้างโดย</th> <th colspan="2">จัดการ</th> </tr> <?php if (isset($_GET['keyword'])) { $keyword = $_GET['keyword']; $sql = "SELECT * from typeOfmedical where medical_name LIKE '%" . $keyword . "%' "; } else { $sql = "select * from typeOfmedical "; } $sql .= " order by date_added desc;"; $result = $db->query($sql, $rows, $num_rows); if ($result) { // print "<pre>" . print_r($rows, 1) . "</pre>"; if ($num_rows == 0) { exit; } foreach ($rows as $k => $v) { print "\n <tr>\n <td>" . $v['medical_name'] . "</td>\n <td>" . $v['added_from'] . "</td>\n <td><a href='delete-typeofmedical.php?id=" . urlencode($v['medical_type_id']) . "' onclick='return confirm(\"ยืนยันการลบข้อมูล ?\");'><i class='fa fa-trash-o'></i></a></td>\n <td><a href='edit-typeofmedical.php?id=" . urlencode($v['medical_type_id']) . "'><i class='fa fa-pencil'></i></a></td>\n </tr>\n "; } } $result = null; $rows = null; $num_rows = null; ?> </table> </div>
public function get() { $sql = 'select * from research where 1;'; parent::query($sql, $rows, $num_rows, $last_id); print_r($rows); }
<?php @(require_once 'config/autoload.inc.php'); use config\database; $conndb = new database(); // $_POST['find'] = ''; if ($_POST['find'] == 'province') { $conndb->query('select * from province where 1;', $rows, $num_rows, $last_id); } elseif ($_POST['find'] == 'amphur') { $sql = 'select * FROM `amphur` WHERE `PROVINCE_ID` = ' . $_POST['ref_id']; $conndb->query($sql, $rows, $num_rows, $last_id); } else { // $sql = 'select * FROM `district` WHERE `AMPHUR_ID` = ' . $_POST['ref_id']; $sql = 'select * FROM `district` '; $conndb->query($sql, $rows, $num_rows, $last_id); } // $json = json_encode($rows, true); // $handle = fopen('district.txt', 'w'); // fwrite($handle, print_r($json, 1)); // fclose($handle); // echo $json;
<?php @(require_once 'config/autoload.inc.php'); use config\database as db; $db = new db(); $sql = 'select * from year where 1;'; $res = $db->query($sql, $rows, $num_rows, $last_id); if ($res) { $json = json_encode($rows); $handle = fopen('logs/gen.txt', 'w'); fwrite($handle, print_r($json, 1)); fclose($handle); // print json_encode($rows); }