Source code of dbdemo1.php

<html>
<head>
<title>First DB Demo</title>
</head>
<body>
<?php

  
// Rather than listing my MySQL password directly in this PHP
  // page, I've stored it in an external file

  
$allLines file("mysql.txt");
  
$password trim($allLines[0]);
  
$dbLink mysql_connect("localhost""tboegel"$password
    or die(
"Can't connect: " mysql_error());

  
mysql_select_db("clearwater"$dbLink)
    or die(
"Can't select clearwater: " mysql_error());

  
$recordset mysql_query("SELECT * FROM customer"$dbLink)
    or die(
"Bad query: " mysql_error());

  while (
$row mysql_fetch_assoc($recordset)) {
    print 
"<p>{$row['c_first']} {$row['c_mi']} {$row['c_last']}<br/>\n";
    print 
"{$row['c_address']}<br/>\n";
    print 
"{$row['c_city']}, {$row['c_state']} {$row['c_zip']}</p>\n";
  }

  
mysql_free_result($recordset);

  
mysql_close($dbLink);

?>

</body>
</html>