Im following a video tutorial on mysql and php, and a certain line of code has me a bit confused:
<?php
$result = mysql_query("SELECT * FROM subjects", $connection);
if(!$result){
die("Database query failed: " .mysql_error());
}
while($row = mysql_fetch_array($result)){
echo $row["Menu_Name"]." ".$row["position"]."<br/>";
}
?>
I want to really understand what this code is doing, so let me see if i got it straight. Basically, what it does on my screen is return the various items store in my table subjects and displays them in their position. It does this by returning them in two arrays, one is the [menu-name] which stores the text for each item and the other is [position] which stores the order in which they come out. So, my while loop goes through this array and outputs. But that's what I dont get. What does $row do and how does it manage to go though and loop through. I may be way off here and was hoping someone could shed some light on this.