#######the FUNCTION########## ##Get The Two Rows Under Different Condition## function getRows($seeds,$timeNoseed) { connect(); $query = mysqli_query(connect(),"SELECT seeds,timeNoseed FROM torrents $ seeds = `$seed` AND timeNoseed = `$timeNoseed`"); if (mysqli_num_rows($query) > 0) { return $query; } else { return 0; } } #######the CODE######## ##Case I: seed = 0; timeNoseed = 0; $seed = 0; $timeNoseed = 0; $result = getRows($seed,$timeNoseed); while ($value = mysqli_fetch_array($result) ) { print $value['seeds'].' '.$value['timeNoseed']."\n"; }