Delete a Simple CRUD Database App: Connecting to MySQL with PHP

example php delete code 


<?php
error_reporting(0);
ini_set(display_errors, 1);
$servername='localhost' ; 
$database_name='crud'; 
$database_username='root';
$database_password=''; 
mysql_connect($servername,$database_username,$database_password);
mysql_select_db($database_name);

$my_st_id=$_REQUEST['stid'];
echo $my_st_id;

$sql = "DELETE FROM `crud`.`myschool` WHERE `myschool`.`stid` = $my_st_id;";
$run_qry = mysql_query($sql);
$my_row = mysql_fetch_array($run_qry);

echo $my_st_id . 'Delete on database Go back Refresh page';

?>

No comments

Note: only a member of this blog may post a comment.