Advertisement
koki2000

query_method from mysql to mysqli

Aug 24th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1. <?php
  2. require_once 'connect.php';
  3.  
  4. function query_method($db = null, $sql = null)
  5. {
  6.     //if ($result = $db->query("SELECT * FROM permissions")) {
  7.     if ($result = $db->query($sql))
  8.     {
  9.         return ($db == null || $sql == null)?false:$result;
  10.     }
  11. }
  12.  
  13. $result = query_method($db ,"SELECT * FROM permissions");
  14.  
  15. if($result->num_rows)
  16. {
  17.     echo '<pre>';
  18.     while($row = $result->fetch_object())
  19.     {
  20.         echo '<pre>';
  21.         print_r($row);
  22.         echo '</pre>';
  23.     }
  24. }
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement