I am trying to get Julie Meloni's mysql example to work on p. 225 of her book "PHP Fast & Easy Web Development."
Here's the source code:
$db_name = "my_db";
$table_name = "my_music";
$conn = mysql_connect("mywebsite, db_name, pword") or die ("Couldn't connect.");
$db = mysql_select_db($db_name, $conn) or die ("Couldn't select database.");
$sql = "
SELECT id, format, title, artist_fn, artist_ln, rec_label, my_notes, date_acq
FROM $table_name
ORDER BY id
";
$result = mysql_query($sql, $conn) or die("Couldn't execute query.");
while ($row = mysql_fetch_array($result))
{
$id = $row['id'];
$format = $row['format'];
.
.
.
}
The query executes, but the problem is, the $row array ends up containing the field names, not the actual stored values.
Is this fetch array call correct? No errata is listed for this page.