Yes, it's me again. I've learned so much and progressed so far that I am to the point of finishing this.
I have a file called AdminPage.php
Works great! Even the Delete link pulls the ID and puts it in there. I looked around the internet for the delete code and found:Code:<html> <body><?php $conn=odbc_connect('Warranty','',''); if (!$conn) {exit("Connection Failed: " . $conn);} $sql="SELECT * FROM WarrantyInformation"; $rs=odbc_exec($conn,$sql); if (!$rs) {exit("Error in SQL");} echo "<table border=1>"; echo "<tr><th>ID</th>"; echo "<th>Requester</th>"; echo "<th>Owner</th>"; echo "<th>Make/Model</th>"; echo "<th>Serial Number</th>"; echo "<th>Recieved</th>"; echo "<th>Shipped</th>"; echo "<th>Ticket Number</th>"; echo "<th>Notes/Comments</th>"; echo "<th>DELETE</th></tr>"; while (odbc_fetch_row($rs)) { $id=odbc_result($rs,"ID"); $requester=odbc_result($rs,"Requester"); $owner=odbc_result($rs,"Owner"); $makemodel=odbc_result($rs,"MakeModel"); $serialno=odbc_result($rs,"SerialNo"); $received=odbc_result($rs,"Received"); $shipped=odbc_result($rs,"Shipped"); $ticketno=odbc_result($rs,"TicketNo"); $notes=odbc_result($rs,"Notes"); echo "<tr><td>$id</td>"; echo "<td>$requester</td>"; echo "<td>$owner</td>"; echo "<td>$makemodel</td>"; echo "<td>$serialno</td>"; echo "<td>$received</td>"; echo "<td>$shipped</td>"; echo "<td>$ticketno</td>"; echo "<td>$notes</td>"; echo '<td><a href="delete.php?id='.$id['ID'].'">Delete</a></td></tr>'; } odbc_close($conn); echo "</table>"; ?></body> </html>
My questions are: 1) Until now all my statements have been using ODBC, this uses MYSQL. Are they interchangable? 2) I have changed the above code to:Code:<? // Connect database. include("connectdb.php"); // Get values from form. $id=$_GET['id']; // Do delete statement. mysql_query("delete from phonebook where id='$id'"); // Close database connection mysql_close(); // Redirect to select.php. header("location:select.php"); ?>
When I click on the DELETE link it goes to a blank page, but never redirects back to AdminPage.php and the record has not been deleted.Code:<? $conn=odbc_connect('Warranty','',''); if (!$conn) {exit("Connection Failed: " . $conn);} // Get values from form. $id=$_GET['ID']; // Do delete statement. mysql_query("delete from WarrantyInformation where id='$id'"); // Close database connection mysql_close(); // Redirect to select.php. header("location:AdminPage.php"); ?>
What am I not doing right?
Thanks for the wonderful help thus far!



Reply With Quote




Bookmarks