How to resolve “Object not found!” error in codeig

2019-08-27 09:41发布

问题:

I get an error in the following code:

if(count($q_cek_login->result())>0)
{
    foreach($q_cek_login->result() as $qck)
    {

        if($qck->ID_JABATAN==1)
        {
            foreach($q_cek_login->result() as $qad)
            {
                $sess_data['logged_in'] = 'yesGetMeLogin';
                $sess_data['username'] = $qad->USERNAME;
                $sess_data['nama'] = $qad->NAMA;
                $sess_data['id_jabatan'] = $qad->ID_JABATAN;
                $this->session->set_userdata($sess_data);
            }

            header('location:'.base_url().'transaksi/pending');
        }
        else
        {
            echo "halo";
        }
    }
}

Error:

Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.

Error 404

localhost 11/05/13 13:45:53 Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1

回答1:

Try using

redirect(site_url('transaksi/pending'));

instead of

header('location:'.base_url().'transaksi/pending');

Also note that base_url does not contain index.php which site_url contains