Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

Delete data from database by ID in php

Sun Oct 26, 2008 7:10 pm

Code:
<html>
<body>
<?php
$cnx 
= mysql_connect('server','user','password');
mysql_select_db('dbname');

$id = '1';
$ok1 = @mysql_query("DELETE FROM Employee WHERE ID='$id'");
if ($ok1) {
  echo('<p>Author deleted successfully!</p>');
}
 else {
  echo('<p>Error deleting author from database!<br />'.
       'Error: ' . mysql_error() . '</p>');
}

?>
</body>
</html>




Post a reply
  Related Posts  to : Delete data from database by ID in php
 Delete data from database table in php     -  
 Displaying images from database instead of the url from data     -  
 How to fill a ComboBox with data from a database in jsp     -  
 Display data from database as Tree Structure in JSP     -  
 form to insert data, upload many files and images , database     -  
 Delete file     -  
 DELETE Commands     -  
 Delete directory in php     -  
 delete file in asp     -  
 Delete a file in php     -  

Topic Tags

PHP Database