After the record deletion i have send header to previous page but it's not happen how could i solved it..
record is already deleted but it still show in that page after pressing ctrl + f5 when page is reload from server at that time the effect of deletion is show.
<?php
include('../config.php');
$table=$_REQUEST['table'];
mysql_query("DELETE FROM ".$table." WHERE id=".$id);
$_SESSION['message']="Deleted Successfully....";
header('Location: ' . $_SERVER['HTTP_REFERER']);
?>
also in all the pages happening same thing adter edit add and all the data base action is showing effect after ctrl+f5 press...
You have not initialised the variable $id
mysql_query("DELETE FROM ".$table." WHERE id=".$id); // Where is $id initialized?
Did you forget to add
$id = $_REQUEST['id'];
If your $id
is not initialised, definitley, mysql_query
will execute some query like:
DELETE FROM ".$table." WHERE id=
Which will not conclude to anything and hence, no delete will occur.
Notes:
1) Do not use mysql_ functions are they are deprecated and will be removed in upcoming PHP versions.
2) You are feeding a variable coming from $_REQUEST
directly to your SQL. The variable needs to be sanitized.
Try this:
<script>
window.location.href="<?php echo $_SERVER['HTTP_REFERER']; ?>";
</script>