I am fetching a row from a database using something like this
<?php
$result = mysql_query("SELECT id,email FROM people WHERE id = '42'");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$row = mysql_fetch_row($result);
echo $row[0]; // 42
echo $row[1]; // the email value
?>
This example shows accessing $row using an index, like $row[0], but this is a path to error. I would like to do it like $row['id'] or $row['email']... how is that possible?