Adobe Dreamweaver

Deleting PHP records from a database.

In this tutorial i will teach you how to delete information stored in your database. This tutorial is a continuation of the PHP Gallery tutorial.

Introduction:

First, we need to download a couple of software to get this working. We will be testing it locally on the computer first, then once it is working we will upload it to the webserver. This tutorial continues after the PGP Gallery, so I am assuming that you have the database setup and working with Dreamweaver. You can follow this tutorial first if you have not. It’s very simple, I will walk you guys through each step. So let us get started.

  1. WAMP5 : http://www.wampserver.com/en/index.php
    • Installing WAMP will automatically create a www folder located in C:\wamp\www
     
    • Create two folder in the www folder called, localroot and webroot
     
    • In the localroot and webroot folder create a folder that will correspond to your site example: trickdigest
    • In the site name folder located in local and web root folders create a image folder. Your folder tree should look like C:\wamp\www\webroot\trickdigest\images EMS SQL Manager for MySQL (WAMP5 comes with a sql manager, you can use it, or which ever one you are familiar with. 

Step1: Create and Setup database

Create a new PHP page verify.php Click ok, and click Bindings.

Click on  and select Recordset. Create the recordset below.

Table Code, copy and paste it into Dreamweaver.

<table width=”400″ border=”0″ align=”center” cellpadding=”2″ cellspacing=”2″>
<tr>
<td colspan=”2″>&nbsp;</td>
</tr>
<tr>
<td width=”90″ bgcolor=”#F4F4F4″>Title:</td>
<td width=”296″ bgcolor=”#E6E6E6″></td>
</tr>
<tr>
<td bgcolor=”#F4F4F4″>Image:</td>
<td bgcolor=”#E6E6E6″></td>
</tr>
<tr>
<td bgcolor=”#F4F4F4″>Thumbnail:</td>
<td bgcolor=”#E6E6E6″></td>
</tr>
<tr>
<td bgcolor=”#F4F4F4″>Description:</td>
<td bgcolor=”#E6E6E6″></td>
</tr>
<tr>
<td bgcolor=”#F4F4F4″>ImageURL:</td>
<td bgcolor=”#E6E6E6″></td>
</tr>
<tr>
<td colspan=”2″ align=”center” valign=”middle” bgcolor=”#F4F4F4″>&nbsp;</td>
</tr>
</table>

Doing that will give you the table below

Click on the (+) next Recordset, you will see the fields shown above.

Click and Drag the title field over to the table as shown below.

Double click on the Recordset (rs67k) name.

This will open the window below. here we will be able to filter the information that will be displayed on the delete page.

click ok when you are finish.

Go back to the main page, in our case its the gallery.php page. Here we will add a delete button linking to the verify.php page.

After adding the delete text, double click on it to add a link

With the delete button highlighted click on the folder you see above opposite the link bar. This will open the window below, here is where we will specify the filters.

Click on the verify.php, now click parameters

Type in the name id, for the value click on the lighting bolt.

Select id and click ok. Text the gallery.php page with the delete button. At this point the filter should work. Next we will delete the information.

Click over to the verify.php page, and add the delete text shown below.

Create a new page and name it delete.php highlight the delete button and link to it as you previously did. With the linking completed. Click on the delete page, here is where we will add the code.

Click Insert > Data Objects > Delete Record

Fill in the information and click ok when you are finished. Save all the pages and upload it to your local site, if you followed along it will work. If you are having problems contact us.

Finish

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button