Home
+ · PHP Scripts
+++ · delete data from a mysql database

delete data from a mysql database

posted in PHP Scripts | on 30.12.2006. 11:35

This php script will delete data from a mysql database.

   <?php

/*
* Change the first line to whatever
* you use to connect to the database.
*
* Change tablename to the name of your 
* database table.
*
* This example would delete a row from
* a table based on the id of the row.
* You can change this to whatever you
* want.
*/

    // Your database connection code
    
db_connect();

    
$query "DELETE FROM tablename WHERE id = ('$id')";

    
$result mysql_query($query);

    echo 
"The data has been deleted.";

?>