title: Getting result in an array from a function with while loop in PHP
body: <p>I have a function in a class called database, the function as below</p>
  
  <pre><code>function getTaskData(){ 
      $q = "SELECT * FROM ".TBL_CLIENT ;
      $result = mysqli_query( $this-&gt;connection,$q);
      if(!$result || (mysqli_num_rows($result) &lt; 1)){
          return NULL;
      }
      /* Return result array */
      ;
      while ($dbarray = mysqli_fetch_array($result)) {
          return $dbarray;    
      }
  }
  </code></pre>
  
  <p>Please note that $dbarray is from while loop, however, i want to call the function to loop out specific data from the table in a while loop</p>
  
  <p>please see below, i am calling the function from another page</p>
  
  <pre><code>$taskData= $database-&gt;getTaskData();
  $taskStatus = $taskData['status'];
  echo $taskStatus
  </code></pre>
  
  <p>I want $taskStatus to be in a loop.</p>