OK, loosely related to the database topic on this list. I have a page that displays the contents of a contact list in an HTML table. The contents are pulled from a MySQL db with a standard PHP query. Nothing special happening there. In this table, I put Edit and Delete links to maintain each line item in the table.
When I click the Delete link (with the unique personID embedded in it), a query goes out and deletes that entry from the database table. I use $PHP_SELF?delContact=$personID to trigger the DELETE query on the same page. However, the page does not completely refresh and the deleted entry still displays. If I click the Refresh button on the browser (IE 5.5) then the deleted line disappears. I know this is less a PHP/DB issue than an HTML issue, but I don't know if I'm using the $PHP_SELF variable properly or if there's another PHP command to redraw the page or what? Aside from the referesh problem, everything else appears to be working fine. For those of you who need it, the code appears below. Any ideas? TIA. <?php require ("templates/db_connect.php"); $sql = "SELECT * from contactInfo ORDER BY lastname"; $result = mysql_query($sql); if (!$result) { echo ( "<p>There has been an error with the database: " . mysql_error().".</p>" ); exit(); } echo (" <table align='center' width='90%' border='1' cellpadding='2'> <tr> <td class='fieldLabel'>Actions</td> <td class='fieldLabel'>Last Name</td> <td class='fieldLabel'>First Name(s)</td> <td class='fieldLabel'>e-mail Address</td> <td class='fieldLabel'>Postal Address</td> <td class='fieldLabel'>Screen Name</td> </tr> "); while ( $row = mysql_fetch_array($result) ) { $personID = $row["personID"]; $lastname = $row["lastname"]; $firstnames = $row["firstnames"]; $street1 = $row["street1"]; $street2 = $row["street2"]; $city = $row["city"]; $state = $row["state"]; $zip = $row["zip"]; $emailaddress = $row["emailaddress"]; $screenname = $row["screenname"]; echo ("<tr>"); echo ("<td align='center' class='bodySmall'><a href='foo.php'>Edit</a> | <a href='".$PHP_SELF."?delContact=$personID'>Delete</a></td>"); echo ("<td class='bodySmall'>".$lastname."</td>"); echo ("<td class='bodySmall'>".$firstnames." </td>"); echo ("<td class='bodySmall'><a href='mailto:".$emailaddress."'>".$emailaddress."</a> </td>"); echo ("<td class='bodySmall'>".$street1."<br>"); if ($street2 != "") { echo ($street2."<br>"); } echo ($city." ".$state." ".$zip."</td>"); echo ("<td class='bodySmall'>".$screenname." </td>"); echo ("</tr>"); } echo ("</table>"); echo ("</div>"); require( "templates/bottom.php" ); if (isset($delContact)) { require ( "templates/db_connect.php" ); $sql = @mysql_query("DELETE FROM contactInfo WHERE personID='$delContact'"); if (!$sql) { /* Should probably open another window to show this message since it'll be buried at the end of the table otherwise. */ echo ("There was a problem communicating with the database. Please try again later."); } } ?> Rich Hutchins -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php