php - When I use Delete query the data will be deleted but it's show until reload page
Get the solution ↓↓↓When I use Delete query the data will be deleted but it's show until reload page. if this is default system then I want to that when i execute delete query the page(self page ) will be automatically reload, or,
public function delete($query){
$delete_row = $this->link->query($query) or die($this->link->error.__LINE__);
if($delete_row){
return "Data Delete Succes";
exit();
} else {
die("Error :(".$this->link->errno.")".$this->link->error);
}
}
if(isset($_GET['status'])){
if($_GET['status'] == 'delete'){
$id = $_GET['id'];
$deleteUserQuery = "DELETE FROM `admin_info` WHERE id= $id";
$result = $crud->delete($deleteUserQuery);
if(isset($result)){
echo $result;
}
}
}
Answer
Solution:
That is by default unless you write a simple code block to automatically refresh the page once the query has executed successfully. You can do this in many ways using php, js etc...
If you are using php, try adding the code block below and change the url to the page name you want the site to redirect
header("Location: url");
Refer the PHP Documentation on the usage of thisheader
element here https://www.php.net/manual/en/function.header.php
Or use AJAX
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: deprecated: directive 'allow_url_include' is deprecated in unknown on line 0
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.