Free Webmaster Resources .info
PHP Introduction and Tutorials Javascript  Introduction and Tutorials HTML  Introduction and Tutorials ASP  Introduction and Tutorials Free Internet Access Guide and Directory Webspace  Directory Webhosting  Directory Adult Webhosting  Directory PHP Hosting  Directory ASP Hosting  Directory
à Navigation
» Home
» Php Introduction
» Php Tutorials
» Submit Scripts
 
Subscribe for free!

Join our mailing list today and recieve free updates monthly with web hosting specials!
 
 

 

 

Free Webmaster Resources .info | Free PHP Tutorials


Adding data to a Database

This is our last part , we have added links to our database and we have displayed these links but damn there are some incorrect links and we need to delete , no problem we will guide you through this .

In this script we will again create a form in which the user/admin enters the link and this is then deleted from the database , if no data is entered then a message is displayed . We could also have deleted links by using their id values but we would probably keep that as an admin function , this example is more for the likes of say a user submitted links site like www.aspin.com for example.

Here is the code for the form , again nothing tricky here.

<form action="deletingfromadb1.php" method ="POST">
<input type = "text" name = "delete" maxlength="50"><br>
<input type = "submit" value = "delete link"><br>
</form>

Now for the script which in this case is called deletingfromadb1.php , remember and add your own details instead of the following section ("hostname","username" ,"password")

<?php
//make our connection details
$connection = mysql_connect("hostname","username" ,"password")
or die ("Cannot make the connection");
//connect to sampledb with our connection details
$db = mysql_selectdb("sampledb" , $connection)
or die ("Cannot connect to the database");
//if the text field wasnt blank enter data
if($delete)
{
//insert the text box data into the sample table
$sql_query = "DELETE FROM sample WHERE link = ('$delete')";
$result = mysql_query($sql_query);
//display the entered link
echo "You entered the following info " . $delete;
echo "<a href='testingourdb.php'>Back to test page</a>";
}
//if it was display a message
else
{
echo ("you didnt enter any data");
}
?>

[more] [1] [2] [3]

Recommended Webhosting Company
Find free web hosting
Looking for free web hosting? Review and compare FindStuff's comprehensive resources. Search now!

 

 
Related Websites
 


Free Email
Your source to free email.

Free Casino Downloads
Contains useful free casino downloads.

Free Software Downloads
A complete collection of free software downloads.

Free
Download free stuff from psike.com your free stuff resource.

Free Teen Online Dating
Meet other singles for free online dating.

Coolfreeweb.com
The Free category at coolfreeweb.com

My Directory Listing
A massive directory listing of websites

Website Collation Project
The website collation project contains a huge directory of websites.


 
Top Webhosts
 
 1. Find free web hosting
 2. free web hosting Web Ho
 3. Web Hosting
 4. Free Web Hosting
 5. Webhosting
 
-
- Give us feedback
 
Last updated
Nov 19, 2008
Free Webmaster Resources .info | A resource must for every web master
Untitled Document - Web Hosting
- PHP Hosting
- Free Internet Access