09-13-2014, 04:51 PM
[eluser]Tpojka[/eluser]
[quote author="scorpioniz" date="1410625708"]
if you would see my code in first post there is commented line with redirect, and if I uncomment it and run it - it's redirecting to page perfectly.. :/ but not at the end of else statement.. :///[/quote]
Can we asume that else block is not executed at all?
Again your code:
I put the comment after line no 16 to suggest reverse solution in case of executing code
Seems like else block is not executed at all, and your redirect function is just in it (already said).
[quote author="scorpioniz" date="1410625708"]
if you would see my code in first post there is commented line with redirect, and if I uncomment it and run it - it's redirecting to page perfectly.. :/ but not at the end of else statement.. :///[/quote]
Can we asume that else block is not executed at all?
Again your code:
Code:
<?php if ( ! defined('BASEPATH') ) exit('No direct script access allowed');
class Someclass extends CI_Controller
{
public function __construct()
{
parent::__construct();
}
public function edit($id = NULL)
{
$user_id = 25;
$event = $this->database->GetSingle('events', array('id' => $id, 'userid' => $user_id));
$this->data['event'] = $event;
//redirect('user/event/show/'.$event['id']);
if($this->form_validation->run('event/createedit') == FALSE)//test here with true
{
$this->ajaxValidation('event/createedit');
}
else
{
if($event == NULL)
{
$this->database->Insert('events', $data);
$event_id = $this -> database -> GetLastID();
}
else
{
$this->database->Update('events', $data, array('id' => $event['id']));
$event_id = $event['id'];
}
redirect('user/event/show/'.$event_id);
}
}
}
Seems like else block is not executed at all, and your redirect function is just in it (already said).