title: is there a way i can create a while loop to fetch only values greater then 0 dynamically and print the field and value?
body: <pre><code>// Connect to server and select databse.
  $conn = mysqli_connect("$host", "$username", "$password")or die("cannot connect"); 
  mysqli_select_db($conn,"$db_name")or die("cannot select DB");
  
  here i am selecting all data from the database 
  
  $sql = "SELECT * FROM $tb2_name WHERE Month='$month' AND Year='$year' AND Employee_Number='$user'";
  $result = $conn-&gt;query($sql);
  
  
      // output data of each row
      $result = mysqli_query($conn, $sql);
      $row = mysqli_fetch_array($result, MYSQLI_BOTH);
  $Tax_Num = $row['Tax_Number'];
      $Number = $row["Employee_Number"];
      $Payslip_Number = $row["Payslip_Number"];
      $Salary = $row["Salary"];
      $Bonus = $row["Bonus"];
      $Housing_Allowance = $row["Housing_Allowance"];
  </code></pre>
  
  <p>There problem comes when a column is created dynamically in the Database and thus will not be able to be defined manually .</p>
  
  <p>is there a way i can create a while loop to fetch only values greater then 0 dynamically ?</p>