title: echo list of array from column database table
body: <p>I am trying to echo a list of all rows from column <code>userid</code> and separate them by comma and remove the last comma from the last value</p>
  
  <pre><code>    $sql_userid = "SELECT `userid` FROM `tabe_users`";
          $result_userid = $con-&gt;query($sql_userid);
          if ($result_userid-&gt;num_rows &gt; 0) {
             while($row_userid = $result_push-&gt;fetch_assoc()) {
             $getallids = mysqli_free_result($result_userid) . ', ';
             $listallids = substr($getallids, 0, -2);
        }
      }
  
  echo $listallids;
  </code></pre>