pdo how to check if it is 1st record that retrieve from database?
问题 $sql3 = "SELECT member FROM levels where upline = ? AND level=1"; $q3 = $conn->prepare($sql3); $q3->execute(array("$level2downlines")); while($r3 = $q3->fetch(PDO::FETCH_ASSOC)){ $level3downlines = $r3['member']; if (it is 1st record){ echo "make orange juice"; }else{ echo "make all juice"; } } Let say output are 3 records from database "Zac", "Michelle", Andrew". "Zac" is the 1st record get from database, how to write the "if" statement to check if the records is 1st record or not? 回答1: