Welcome Guest, Not a member yet? Register   Sign In
[SOLVED]database error occurred
#1

[eluser]kikz4life[/eluser]
The scenario is i when i update my CI version to 1.7.2 from 1.6.3, this problem arise. It says Database Error Occurred. Traced the said error from my model.php in this code:
Code:
function getTypes($datacode)
    {
        $this->db->select('data_id,data_value,data_display,description');
         $this->db->where("data_code='$datacode' AND display='1'");
        $this->db->orderby("order_idx", "asc");
        $query = $this->db->get('sec_dataset');
        return $query->result();        
    }

I tried to modify it to
Code:
function getTypes($datacode)
    {            
        $this->db->select('data_id,data_value,data_display,description');
        $query =$this->db->where('data_code', $datacode);
            $query =$this->db->where('display',1);
        $this->db->orderby("order_idx", "asc");
        $query = $this->db->get_where('sec_dataset');
        return $query->result();        
    }

Its working but no data displayed/retrieved from my db. and my firebug said that its now Internal Server ErrorSad

Could anyone help me with this. I'm thinking of not upgrading if many problem arise.
#2

[eluser]pistolPete[/eluser]
Try some debugging:

Code:
function getTypes($datacode)
{            
        $this->db->select('data_id,data_value,data_display,description');
        $this->db->where('data_code', $datacode);
        $this->db->where('display',1);
        $this->db->orderby("order_idx", "asc");
        $query = $this->db->get_where('sec_dataset');
        die('<pre>'.print_r($query,TRUE).'</pre>');
        return $query->result();        
}
What output do you get?

How do you process the query result in your controller / view?
#3

[eluser]marjune[/eluser]
you better try your query first in the mysql console or in php my admin before you apply in the php code!!
#4

[eluser]kikz4life[/eluser]
this is the output that i got when insert this code die('<pre>'.print_r($query,TRUE).'</pre>');:
Code:
CI_DB_mysql_result Object
(
    [conn_id] => Resource id #35
    [result_id] => Resource id #103
    [result_array] => Array
        (
        )

    [result_object] => Array
        (
        )

    [current_row] => 0
    [num_rows] => 2
    [row_data] =>
)

Controller

Code:
function index()
    {
        ........
        $data['order_type'] = $this->Dataset_db->getTypes('CUST_TYPE');
    $data['internal_terms'] = $this->Dataset_db->getTypes('TERMS');
    $data['customer_terms'] = $this->Dataset_db->getTypes('TERMS');
    $data['operator'] =$this->Dataset_db->getSearchTypes('OPERATOR');        
    $data['content'] = $this->load->view('home',$data,true);
    $this->load->vars($data);
    $this->load->view('default_view');
    }
        }

i'm using the flexigrid jquery for the view.

modifying and using the two where clause this is the error the i get(firebug):
POST http://localhost/myweb/ar_salesorder/listview
500 Internal Server Error
979ms




Theme © iAndrew 2016 - Forum software by © MyBB