IslamYearul
IslamYearul

Reputation: 328

When I use Delete query the data will be deleted but it's show until reload page

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;
             }

        }
    }


 

Upvotes: 1

Views: 592

Answers (1)

Aasif Nawasdeen
Aasif Nawasdeen

Reputation: 46

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 this header element here https://www.php.net/manual/en/function.header.php

Or use AJAX

Upvotes: 1

Related Questions