Welcome Guest, Not a member yet? Register   Sign In
[SOLVED]500 Internal Server Error
#1

[eluser]kikz4life[/eluser]
just upgraded my ci version to 1.7.2 and i encountered an 500 Internal Server Error in my website. its irritating becoz some of the module are working fine but some are not. grrR...

this is the error logs found by firebug and also to make it more detailed i've post my model.php here.

POST http://localhost/myweb/ar_salesorder/listview 500 Internal Server Error 1.59s
Code:
<html>
<head>
<title>Database Error</title>
<style type="text/css">

body {
background-color:    #fff;
margin:                40px;
font-family:        Lucida Grande, Verdana, Sans-serif;
font-size:            12px;
color:                #000;
}

#content  {
border:                #999 1px solid;
background-color:    #fff;
padding:            20px 20px 12px 20px;
}

h1 {
font-weight:        normal;
font-size:            14px;
color:                #990000;
margin:             0 0 4px 0;
}
</style>
</head>
<body>
    <div id="content">
        <h1>A Database Error Occurred</h1>
        <p>Error Number: 1064</p><p>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM (`erp_ar_so`)
LEFT JOIN `erp_maint_customers` erp_b ON `erp_ar_so`.`client_' at line 2</p><p>SELECT `so_id` as pkey, `so_no`, DATE_FORMAT(so_date, `'%b` %d, `%Y')`, `erp_e`.`data_display` as type, `erp_b`.`customer_name`, `emp_name`, `net`, `erp_ar_so`.`contact`, `k`.`data_display` as status
FROM (`erp_ar_so`)
LEFT JOIN `erp_maint_customers` erp_b ON `erp_ar_so`.`client_id`=`erp_b`.`cust_id`
LEFT JOIN `erp_maint_customers` erp_c ON `erp_ar_so`.`del_client_id`=`erp_c`.`cust_id`
LEFT JOIN `erp_maint_employee` erp_d ON `erp_ar_so`.`salesman_id`=`erp_d`.`emp_id`
LEFT JOIN `erp_sec_dataset` erp_e ON `erp_ar_so`.`type_id`=`erp_e`.`data_id`
LEFT JOIN `erp_sec_dataset` k ON `erp_ar_so`.`status`=`k`.`data_value` AND k.data_code = "TRAN_STATUS"
WHERE `erp_ar_so`.`is_deleted` = '0'
ORDER BY `so_date` desc
LIMIT 15</p>    </div>
&lt;/body&gt;
&lt;/html&gt;

This is my MODEL

Code:
function getList()
    {
        $sortname = $this->input->post('sortname');
        $sortorder = $this->input->post('sortorder');
        $page = $this->input->post('page');        
        $rp = $this->input->post('rp');        
        
        $query = $this->input->post('query');
        $qtype = $this->input->post('qtype');
        
        $stype = $this->input->post('s_type');
        $otype = $this->input->post('o_type');
        $skey = $this->input->post('s_key');
        if (!$sortname) $sortname = 'so_id';
        if (!$sortorder) $sortorder = 'DESC';
        
        if (!$page) $page = 1;        
        if (!$rp) $rp = 25;
                
        $start = (($page-1) * $rp);
        
        $this->db->start_cache();
        
        if ($stype)
        {
            foreach ($stype as $key => $value)
            {
                if ($skey[$key])
                {
                    if ($stype[$key]=='so_date')  $match = convertDate($skey[$key]);
                    else $match = $skey[$key];
                    
                    switch ($otype[$key])
                    {
                        case "=":
                            $this->db->where($stype[$key],$match);
                            break;
                        case "!=":
                            $this->db->where($stype[$key]." !=",$match);
                            break;
                        case "like":
                            $this->db->like($stype[$key],$match);
                            break;
                        case ">":
                            $this->db->where($stype[$key]." >",$match);
                            break;
                        case "<":
                            $this->db->where($stype[$key]." <",$match);
                            break;
                    }
                }
            }
            
        }
        //if (isset($filter)) $this->db->like($filter);
        
        $this->db->join('maint_customers erp_b','ar_so.client_id=b.cust_id','left');
        $this->db->join('maint_customers erp_c','ar_so.del_client_id=c.cust_id','left');
        $this->db->join('maint_employee erp_d','ar_so.salesman_id=d.emp_id','left');
        $this->db->join('sec_dataset erp_e','ar_so.type_id=e.data_id','left');
        $this->db->from('ar_so');
        $this->db->where('ar_so.is_deleted','0');
        $num = $this->db->count_all_results();        
    
        $this->db->join('sec_dataset k','ar_so.status=k.data_value AND k.data_code = "TRAN_STATUS"','left');
        $this->db->select("so_id as pkey, so_no, DATE_FORMAT(so_date,'%b %d, %Y'), e.data_display as type, b.customer_name, emp_name, net, ar_so.contact, k.data_display as status");
        $this->db->order_by($sortname,$sortorder);
        $this->db->limit($rp, $start);
        $query = $this->db->get("ar_so");
        echo $this->db->last_query();
        
        //echo $this->db->last_query();
        //exit;
        
        $this->db->flush_cache();

        $data['db'] = $query;        
        $data['page'] = $page;
        $data['num'] = $num;
        return $data;            
        
    }

in the previous version of CI 1.6.3 that i used its been working perfectly fine, i'm thinking that this is a bug in CI in terms of join sql statements.


Messages In This Thread
[SOLVED]500 Internal Server Error - by El Forum - 10-22-2009, 08:39 PM
[SOLVED]500 Internal Server Error - by El Forum - 10-23-2009, 03:22 AM
[SOLVED]500 Internal Server Error - by El Forum - 10-23-2009, 05:10 AM
[SOLVED]500 Internal Server Error - by El Forum - 10-23-2009, 05:42 AM
[SOLVED]500 Internal Server Error - by El Forum - 10-23-2009, 07:18 AM
[SOLVED]500 Internal Server Error - by El Forum - 10-23-2009, 07:42 AM
[SOLVED]500 Internal Server Error - by El Forum - 10-25-2009, 08:41 PM
[SOLVED]500 Internal Server Error - by El Forum - 10-25-2009, 09:01 PM
[SOLVED]500 Internal Server Error - by El Forum - 10-26-2009, 12:52 AM
[SOLVED]500 Internal Server Error - by El Forum - 10-26-2009, 01:34 AM



Theme © iAndrew 2016 - Forum software by © MyBB