Looping through the MySQL result set using mysqli_fetch_array function in php. *Note: $con is DB connection object. //Executing the sql query and storing result into $query variable. $query = mysqli_query($con,"select * from user_coins where date >= '$calDate' AND `isBonusCalculated`='0' "); //Checking if result set having rows more than 0. if(mysqli_num_rows($query)>0){ // looping th' the result set using mysqli_fetch_array function. while($row=mysqli_fetch_array($query)){ echo $row['userid']; echo $row['balance']; } } else { echo "No data found"; }
Short & to the point working PHP snipes.