php - Redirect after a DB update
So, I'm using this php function to update a database in a site.
public function ativo($id, $ativo) {
if ($ativo == 0) {
$data['ATIVO'] = 1;
}
if ($ativo == 1) {
$data['ATIVO'] = 0;
}
$this->db->where('CLIENTE.idCLIENTE', $id);
$this->db->update('CLIENTE', $data);
header("Location: -imagine-a-web-address-here");
}
The problem is, I keep getting a blank page after the db update, so the header() isn't really helping me.
Is there any problem with the code or other function to redirect to the address? Thx for the help.
Answer
Solution:
What is the error you got?
Try this;
header('location:'.$_SERVER['HTTP_REFERER']); or redirect($_SERVER['HTTP_REFERER']);
Source