Deleting PHP record from 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.
First we need to download couple software to get this working. We will be testing it locally on the computer first, then once its working we will upload it to the web server. 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. Its very simple, i will walk you guys through each step. So lets get started.
- 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.
Table Code, copy and paste it into Dreamweaver.
<table width=”400″ border=”0″ align=”center” cellpadding=”2″ cellspacing=”2″>
<td colspan=”2″> </td>
<td width=”90″ bgcolor=”#F4F4F4″>Title:</td>
<td width=”296″ bgcolor=”#E6E6E6″></td>
<td colspan=”2″ align=”center” valign=”middle” bgcolor=”#F4F4F4″> </td>
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 finish. 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.