Advertisement
mstranieri

foreach problem

Oct 30th, 2015
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.95 KB | None | 0 0
  1. function get_works($status) {
  2.     $CI = &get_instance();
  3.     $query = "SELECT * FROM manager_works";
  4.    
  5.     if(!isset($status) || empty($status)) {
  6.         $status = array('READY');
  7.     }
  8.    
  9.     foreach ($status as $s) {
  10.         $CI->db->or_where('state', $s);
  11.     }
  12.    
  13.     $query = $CI->db->query($query);
  14.    
  15.     if ($query->num_rows() == 1) {
  16.         return count($query->row());
  17.     } else {
  18.         return 0;
  19.     }
  20. }
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27. // A PHP Error was encountered
  28.  
  29. // Severity: Warning
  30.  
  31. // Message: Invalid argument supplied for foreach()
  32.  
  33. //  Filename: helpers/rocks_helper.php
  34.  
  35. //  Line Number: 24
  36.  
  37. //  Backtrace:
  38.  
  39. //  File: /var/www/vhosts/intranet.**********/httpdocs/application/helpers/rocks_helper.php
  40. //  Line: 24
  41. //  Function: _error_handler
  42.  
  43. //  File: /var/www/vhosts/intranet.**********/httpdocs/application/controllers/Login.php
  44. //  Line: 21
  45. //  Function: get_works
  46.  
  47. //  File: /var/www/vhosts/intranet.**********/httpdocs/index.php
  48. //  Line: 292
  49. //  Function: require_once
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement