In this example there is $row[0] but in other parts of the code there are different numbers. What is the significance of the number between the [ and the ] ?
I have spent the last several hours reading the online PHP and MySQL manuals without finding the information.
But as part of my learning:
In a previous script, I selected 5 items from the MySQL database and then added the token_id to the array. Would this make token_id be at $row[5]?
I am assuming $row was created from something like
$row = mysql_fetch_array($result);
where $result is the output result set from a database query.
If so, then say each row of data in $result contains 3 columns of data - firstName, lastName, emailAddress.
$row[0] will refer to the first column’s data - firstName
$row[1] will refer to the secon column’s data - lastName
and so on.
Instead of using an indexed array you could use mysql_fetch_assoc() instead which returns an associative array for $row. In this case you can refer to the column names by their actual returned names in $result.
So the value for firstName in a row could be referenced with $row[‘firstName’]
$row is an array - it can therefore contain many different values all at the same time with one value stored in the first position $row[0], a different value in the second position $row[1] and so on for as many values as $rows stores.