I have made this function to delete the record from the table. When the delete operation is done, the page displays all data(including the deleted one), But, I need to refresh or reload the page to see the results after I have deleted the row. How it can be done in following code? Thanx in advance!!
public function deletedata(){
if(isset($_GET['del_id'])){
$delete_id = $_GET['del_id'];
$query ="DELETE FROM tbl_data WHERE project_id ='".$delete_id."' ";
$this->databaseObject->getConnection()->query($query);
}
Usually you’d use the
headerfunction to reload a page.Something like this should work:
header('Location: '.$_SERVER['REQUEST_URI']);http://php.net/manual/en/function.header.php
Alternatively, depending on the structure of your code you could simply call the delete code before the code that retrieves the records. That way you’d avoid the need to reload the page.