php datagrid delete page problem
Hello i am working with datagrid . i have done with pagination and edit now i am getting problem with delete . in pagination it automatically make pages in one page . here is the code from where i am calling
$deletetUrl = "admin.php?page=delete_user&id=".$data["user_id"]."&pageid=".$pageNumber." ";
$delete = "<a href='".$deletetUrl."'><img src='".$assets."edit-delete.png' alt='Delete' title='Delete' border='0' height='16' width='16'></a>";
its going to this page
<?php
echo $query = "Delete from user where user_id=$_GET[id]";
$result = mysql_query($query);
?>
<script type="text/javascript">
window.location="admin.php?page=view_user&开发者_StackOverflow社区;pageid=<?php echo urlencode($_GET[pageid]); ?>"
</script>
it delete perfectly and with this javascript function it goes back it goes to page 1 of the records although i have delete from another page . please let me how can i go to same page from where i have deleted the record in this case or anybody can suggest small ajax function which can come up with the soluction
<?php
/* You should sanitize the $_GET['id'] input & restrict access to this page as
your vulnerable to sql injection as posting ?id=1 would most likely delete your admin user
*/
$query = "Delete from user where user_id=$_GET[id]";
$result = mysql_query($query);
header('Location: admin.php?pageid='.$_REQUEST['pageid']);
?>
精彩评论