note 117683 deleted from debugger by tularis
| From: | tularis@php.net | Date: | Tue, 21 Jul 2015 14:24:37 +0000 |
| Subject: | note 117683 deleted from debugger by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-203155@lists.php.net to get a copy of this message | ||
Note Submitter: ms62p at yahoo dot com
----
<?php
require "dbinfo.php";
$sql="SELECT * FROM contacts ORDER BY last ASC";
$result = mysql_query($sql, $db) or die(mysql_error());
$pageTitle = "My Contacts Database";
include "header.php";
print <<<HERE
<h2>My Contacts</h2>
Select a record to edit or delete or <a href="addbyform.php">add new
contacts</a>.
<table id="home">
HERE;
while ($row=mysql_fetch_array($result)){
$id=$row["contactID"];
$email=$row["email"];
$first=$row["first"];
$last=$row["last"];
$phone=$row["phone"];
$image=$row["image"];
// assign a variable name to the image name
$filename = "images/$image";
//check to see if a file is there for the picture
if (!file_exists($filename)){
$filename="images/blank.gif";// if it doesn't exist, set it equal to
"blank"
}
print <<<HERE
<tr>
<td>
<form method="post" action="confirmdelete.php">
<input type="hidden" name="sel_record" value="$id">
<input type="submit" name="delete" value=" Delete
"></form>
<form method="post" action="updateform.php">
<input type="hidden" name="sel_record" value="$id">
<input type="submit" name="update" value=" Edit "></form>
</td>
<td align="center"><img src="$filename" /></td>
<td><strong>$first $last</strong><br />
Phone: $phone<br />
<a href="mailto:
$email">$email</a></td></tr>
HERE;
}
print "</tr></table></body></html>";
?>