CodeIgniter Forums

Full Version: Every body please help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]pembelajar[/eluser]
At first there was no problem on my CI aplication, but now error with message:

Fatal error: Maximum execution time of 30 seconds exceeded in /home/dwiku/public_html/system/libraries/Table.php on line 270

Every body please explain whats wrong with my CI application...

El Forum

[eluser]wiredesignz[/eluser]
PHP has as script execution time limit of 30 seconds. It's possible your table has too many rows and is taking too long to render.

El Forum

[eluser]pembelajar[/eluser]
I'm using library table just for smiley, and using div for others...
please help, where the wrong code for my script?

El Forum

[eluser]xwero[/eluser]
you probably have an infinite loop somewhere. Show us your code so we can find what's wrong

El Forum

[eluser]geshan[/eluser]
Try increasing your maximum execution time (max_execution_time) to something like 45 or 60 in PHP.ini file if your web-host allows that is.

El Forum

[eluser]pembelajar[/eluser]
thanks for all attention Smile ...

here is the controller

Code:
<?php

class Blog extends Controller {

    function Blog()
    {
        parent::Controller();
        
        //panggil pustaka
        $this->load->library('trackback');
        $this->load->library('table');
        $this->load->library('pagination');
        $this->load->library('validation');
        $this->load->helper('date');
        $this->load->helper('smiley');
        $this->load->model('pagingblog');
        $this->load->model('blog_extended');
    }
    
    function index()
    {
        // paging
        $config['base_url']   = base_url().'index.php/blog/index';
        $config['total_rows'] = $this->db->count_all('blog');
        $config['per_page']   = '5';
        $config['uri_segment']= '3';
        $this->pagination->initialize($config);
        $num = $this->uri->segment(3);
        if($num === "all"){
            $data['blog'] = $this->pagingblog->getPaginated('blog',$config['per_page']);
        }
        else{
            if(!isset($num) OR !is_numeric($num)) $num = 0;
            $data['blog'] = $this->pagingblog->getPaginated('blog',$config['per_page'],$num);
        }
        
        // load blog
        $data['query'] = $this->db->get('blog');
        $data['header'] = $this->load->view('header', $data, TRUE);
        $data['footer'] = $this->load->view('footer', $data, TRUE);
        $this->load->view('blog_index', $data);
    }
    
    function view()
    {
        // menghitung pembaca
        $id = $this->uri->segment(3);
        $sql = "UPDATE blog SET view=view+1 WHERE permalink='$id'";
        $this->db->query($sql);
        
        // smileys
        $image_array = get_clickable_smileys(base_url().'assets/images/smileys/');
        $col_array = $this->table->make_columns($image_array, 6);            
        $data['smiley_table'] = $this->table->generate($col_array);
        
        // parameter validasi
        $rules['author']    = "trim|required|xss_clean";
        $rules['email']        = "trim|required|valid_email";
        $rules['komentar']    = "trim|required|xss_clean";
        $this->validation->set_rules($rules);
        $fields['author']    = 'Nama';
        $fields['email']    = 'Email';
        $fields['komentar']    = 'Komentar';
        $this->validation->set_fields($fields);
        
        // identifikasi
        $data['querykomentar'] = $this->db->get_where('komentar', array('permalink' => $id, 'status' => 1));
        $data['query'] = $this->db->get_where('blog', array('permalink' => $id));
                
        // tampilkan detail
        $data['header'] = $this->load->view('header', $data, TRUE);
        $data['footer'] = $this->load->view('footer', $data, TRUE);
        $this->load->view('blog_view', $data);
    }
    
    function input_komentar()
    {
        // parameter validasi
        $rules['author']    = "trim|required|xss_clean";
        $rules['email']        = "trim|required|valid_email";
        $rules['komentar']    = "trim|required|xss_clean";
        
        $this->validation->set_rules($rules);
        
        $fields['author']    = 'Nama';
        $fields['email']    = 'Email';
        $fields['komentar']    = 'Komentar';

        $this->validation->set_fields($fields);
        
        if ($this->validation->run() == FALSE)
        {
            $data['uri'] = $_POST['permalink'];
            $data['header'] = $this->load->view('header', $data, TRUE);
            $data['footer'] = $this->load->view('footer', $data, TRUE);
            $this->load->view('komentar', $data);
        }
        else
        {
        
            function br($string) {
                $string = ereg_replace("\n","<br />",$string);
                return($string);
            }
        
            function teksbersih($teks) {
                $bad_entities = array("&", "<", ">");
                $safe_entities = array("&amp;", "&lt;", "&gt;");
                $teks = str_replace($bad_entities, $safe_entities, $teks);
                return $teks;
            }
            
            $komentar = br(teksbersih($_POST['komentar']));
            
            $sql = "INSERT INTO komentar (".
            "permalink, ".
            "ip, ".
            "tanggal, ".
            "author, ".
            "email, ".
            "komentar) VALUES ('".
            $_POST['permalink']."','".
            $_POST['ip']."','".
            $_POST['tanggal']."','".
            $_POST['author']."','".
            $_POST['email']."','".
            $komentar."')";
            $this->db->query($sql);
            redirect('blog/view/'.$_POST['permalink'].'/berhasil');
           }
    
    }
    
}
?&gt;

El Forum

[eluser]pembelajar[/eluser]
And the view code

Code:
&lt;?=$header?&gt;

        &lt;?php
        $this->db->order_by('order', 'asc');
        $frontpanel1 = $this->db->get_where('panel', array('posisi' => 2, 'status' => 1, 'front' => 1));
        foreach ($frontpanel1->result() as $rowpanel1)
        {
            if ($rowpanel1->tipe == 'modul') { ?&gt;
                <div class="contentbar">
                    <div class="contentbar-title">&lt;?=$rowpanel1->nama?&gt;</div>
                    <div class="contentbar-isi">&lt;?=$this->load->model('modul/'.$rowpanel1->source.'/'.$rowpanel1->source)?&gt;</div>
                    <div></div>
                  </div>
            &lt;?php } else { ?&gt;
                <div class="contentbar">
                    <div class="contentbar-title">&lt;?=$rowpanel1->nama?&gt;</div>
                    <div class="contentbar-isi">&lt;?=$rowpanel1->isi?&gt;</div>
                    <div></div>
                  </div>
            &lt;?php }
        }
        ?&gt;
      

  <div class="contentbar">
  <div class="contentbar-title">Recent Blog</div>
    &lt;?php if ($query->num_rows() > 0): ?&gt;
    <div class="contentbar-isi">
    &lt;?php foreach ($blog as $id => $blog) { ?&gt;
    <div class="section">
      <div>
        <div class="section_title">
          &lt;?=$blog['judul']?&gt;
        </div>
        <div>
          &lt;?=$this->blog_extended->get_extended($blog['isi'])?&gt;
        </div>
        <div class="section_tools">
          <span class="tool date">&lt;?=mdate("%d-%m-%Y",$blog['tanggal'])?&gt;</span>
          <span class="tool view">&lt;?=$blog['view']?&gt; kali dilihat</span>
          &lt;?php $totalkomentar = $this->db->get_where('komentar', array('permalink' => $blog['permalink'], 'status' => 1)); ?&gt;
          &lt;?=$this->blog_extended->get_link($blog['isi'], $blog['permalink'], $totalkomentar->num_rows())?&gt;
        </div>
      </div>
    </div>
    &lt;?php } ?&gt;
    <div class="pagination">&lt;?php echo $this->pagination->create_links();?&gt;</div>
    </div>
    &lt;?php else: ?&gt;
    <div class="contentbar-isi">Belum ada data.</div>
    &lt;?php endif; ?&gt;
  </div>
  
        &lt;?php
        $this->db->order_by('order', 'asc');
        $frontpanel2 = $this->db->get_where('panel', array('posisi' => 3, 'status' => 1, 'front' => 1));
        foreach ($frontpanel2->result() as $rowpanel2)
        {
            if ($rowpanel2->tipe == 'modul') { ?&gt;
                <div class="contentbar">
                    <div class="contentbar-title">&lt;?=$rowpanel2->nama?&gt;</div>
                    <div class="contentbar-isi">&lt;?=$this->load->model('modul/'.$rowpanel2->source.'/'.$rowpanel2->source)?&gt;</div>
                    <div></div>
                  </div>
            &lt;?php } else { ?&gt;
                <div class="contentbar">
                    <div class="contentbar-title">&lt;?=$rowpanel2->nama?&gt;</div>
                    <div class="contentbar-isi">&lt;?=$rowpanel2->isi?&gt;</div>
                    <div></div>
                  </div>
            &lt;?php }
        }
        ?&gt;
  
&lt;?=$footer?&gt;

El Forum

[eluser]frenzal[/eluser]
Haven't looked for the problem but couldn't help noticing this:
function br($string) {
$string = ereg_replace("\n","<br />",$string);
return($string);
}

haven't you heard of nl2br()? Smile

El Forum

[eluser]jbowman[/eluser]
Also, why do you have function declarations within functions?