CodeIgniter Forums
Have a problem cant figure out... - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Have a problem cant figure out... (/showthread.php?tid=6723)



Have a problem cant figure out... - El Forum - 03-09-2008

[eluser]zeedy2k[/eluser]
Sorry for being a pain and asking but I have tried everything and while Im learning PHP I dont have the knowledge to work out this problem...

If you look at http://www.findajobni.com/browse/accounting/2147483647 you will see numerous errors but its counting the right jobs for that category...

Now the code I am using it working on another site I have done and I just copied across and modified... here is the code in the controller:

Code:
$countit = $this->db->query("SELECT * FROM `jobs` WHERE `category` = '".$this->uri->segment(3)."' ORDER BY `id` ASC");
        $count = $countit->num_rows();
        if ($count == "0"){
            $data['pagetitle'] = $this->config->item('sitename')." No Jobs Found";
            $this->load->view('browsingnoresult',$data);
        } else {
        $this->load->library('pagination');
        $config['base_url'] = site_url('browse/'.$this->uri->segment(2).'/'.$this->uri->segment(3).'');
        $config['total_rows'] = $count;
        $config['per_page'] = 10;
        $config['uri_segment'] = 4;
        $config['next_link'] = 'Next >';
        $config['prev_link'] = '<Previous';
        $this->pagination->initialize($config);
        $num = $config['per_page'];
        $offset = $this->uri->segment(4);
        
        $this->db->where('category', $this->uri->segment(3));
        $this->db->orderby("id","desc");
        $data['query']= $this->db->get('jobs', $num, $offset);
        $data['count'] = $count;
        $data['links']=$this->pagination->create_links();
        $data['pagetitle'] = $this->config->item('sitename')." : Browsing Jobs";
        $this->load->view('browsing',$data);

The initial repeat call is this
Code:
<?
foreach($query->result() as $row):
?>

and ends with
<?php endforeach; ?>
And each tag is called as $row->dbcolumn;

Really am stuck... any help reallllllllly appreciated :d

Robert


Have a problem cant figure out... - El Forum - 03-09-2008

[eluser]zeedy2k[/eluser]
Sorry, figured it out... I was running another query called $query so I just changed that name...