Welcome Guest, Not a member yet? Register   Sign In
cannot user redirect() function..
#11

[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:
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);
  }
}
}
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).


Messages In This Thread
cannot user redirect() function.. - by El Forum - 09-12-2014, 07:26 AM
cannot user redirect() function.. - by El Forum - 09-12-2014, 09:12 PM
cannot user redirect() function.. - by El Forum - 09-13-2014, 07:15 AM
cannot user redirect() function.. - by El Forum - 09-13-2014, 08:28 AM
cannot user redirect() function.. - by El Forum - 09-13-2014, 09:00 AM
cannot user redirect() function.. - by El Forum - 09-13-2014, 09:20 AM
cannot user redirect() function.. - by El Forum - 09-13-2014, 09:28 AM
cannot user redirect() function.. - by El Forum - 09-13-2014, 09:36 AM
cannot user redirect() function.. - by El Forum - 09-13-2014, 04:17 PM
cannot user redirect() function.. - by El Forum - 09-13-2014, 04:19 PM
cannot user redirect() function.. - by El Forum - 09-13-2014, 04:51 PM
cannot user redirect() function.. - by El Forum - 09-13-2014, 07:08 PM
cannot user redirect() function.. - by El Forum - 09-15-2014, 12:22 AM
cannot user redirect() function.. - by El Forum - 09-15-2014, 01:12 AM
cannot user redirect() function.. - by El Forum - 09-15-2014, 05:39 PM
cannot user redirect() function.. - by El Forum - 09-15-2014, 06:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB