I am using codeIgniter
public function add()
{
if(!$this->session->userdata('id') || !$this->session->userdata('email'))
{
echo "please enter before";
exit();
}
$user_id = $this->session->userdata('id');
$organization = $this->input->post('organization');
$adress = $this->input->post('adress');
$responsable = $this->input->post('responsable');
$doljnost = $this->input->post('doljnost');
$rab_tel = $this->db->escape($this->input->post('rab_tel'));
$mob_tel = $this->db->escape($this->input->post('mob_tel'));
$desc = $this->db->escape($this->input->post('desc'));
$uslovia = $this->db->escape($this->input->post('uslovia'));
$ocobennosti = $this->db->escape($this->input->post('ocobennosti'));
$coupons = $this->input->post('coupons');
$discount = $this->input->post('discount');
$category = $this->input->post('category');
$days = $this->input->post('days');
if(empty($discount) || empty($adress) || empty($mob_tel) || empty($discount))
{
$this->session->set_flashdata('error', 'fill the inputs');
$data['content'] = $this->load->view('user_add', null, true);
$this->load->view('layout', $data);
}
else
{
$this->db->query('INSERT INTO user_adds (`organization`, `adress`,
`responsable`, `doljnost`, `rab_tel`,
`mob_tel`,`desc`, `uslovia`, `ocobennosti`, `coupons`, `category`, `end`, `user_id`) VALUES
("'.$organization.'", "'.$adress.'", "'.$responsable.'",
"'.$doljnost.'", "'.$rab_tel.'", "'.$mob_tel.'",
"'.$desc.'", "'.$uslovia.'", "'.$ocobennosti.'",
"'.$coupons.'", "'.$category.'", NOW() + INTERVAL '.$days.' DAY, "'.$user_id.'")');
redirect('/');
}
}
after this method is executed, then when i pass to another page, its show me this error
502 Bad Gateway
The server returned an invalid or incomplete response.
What i am doing wrong??
the session library is automatic loaded, i am just passing to this method and it is not nessesary to submit
You just putted local variables and an insert into mysql db. Never touched something that make calls to HTTP(client) or that accept HTTP (server).
The only thing that appears to be somehow related to HTTP is the call of a local function called redirect. May be the problem is there.
502 Bad Gateway is generally returned by a reverse proxy when the local HTTP delivery to the backend server fails. Try to comment out redirect("/") to see what happens
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.