I´ve managed to build some pretty advanced stuff during my PHP-coding days, but I´ve always been a cut and paste programmer with no actually insight in how stuff works. Trying to change that now but got stuck at this:
$sql = "select name, lenght from ships;
$result = mysql_query($sql, $db_conn);
while($ships=mysql_fetch_array($result)) {
}
WHAT makes this loop work ? I mean how is PHP told that for each iteration of the while loop it should take the next row from the database result ?
Also, say I do this:
$sql = "select name, lenght from ships;
$result = mysql_query($sql, $db_conn);
$ships=mysql_fetch_array($result);
and want to echo for instance $ships[name] from the second line of the selected table, not the first, how would I go about doing that ? I do understand there are easier ways to do just that w/o using fetch_array but this question is more just to help me understand.
Thanx in advance for all replies.