Database Syntax error Codeigniter Grocery Crud with SQLite

164 Views Asked by At

I have created one application with Codeigniter Grocery Crud with SQLite. It is working fine at localhost. But when I hosted online by CPanel, it shows syntax error following,

A Database Error Occurred
Error Number: HY000/1

near "SHOW": syntax error

SHOW COLUMNS FROM 'epaper'

Filename: models/Grocery_crud_model.php

Line Number: 436

At File: models/Grocery_crud_model.php 436 line is following

 foreach($this->db->query("SHOW COLUMNS FROM '$this->table_name' ")->result() as $db_field_type)

And Full Model is

 function get_field_types_basic_table()
    {
        $db_field_types = array();
    foreach($this->db->query("SHOW COLUMNS FROM '$this->table_name' ")->result() as $db_field_type)
        {
            $type = explode("(",$db_field_type->Type);
            $db_type = $type[0];

            if(isset($type[1]))
            {
                if(substr($type[1],-1) == ')')
                {
                    $length = substr($type[1],0,-1);
                }
                else
                {
                    list($length) = explode(" ",$type[1]);
                    $length = substr($length,0,-1);
                }
            }
            else
            {
                $length = '';
            }
            $db_field_types[$db_field_type->Field]['db_max_length'] = $length;
            $db_field_types[$db_field_type->Field]['db_type'] = $db_type;
            $db_field_types[$db_field_type->Field]['db_null'] = $db_field_type->Null == 'YES' ? true : false;
            $db_field_types[$db_field_type->Field]['db_extra'] = $db_field_type->Extra;
        }

        $results = $this->db->field_data($this->table_name);
        foreach($results as $num => $row)
        {
            $row = (array)$row;
            $results[$num] = (object)( array_merge($row, $db_field_types[$row['name']])  );
        }

        return $results;
    }

For More Reference https://github.com/scoumbourdis/grocery-crud/blob/master/application/models/Grocery_crud_model.php

Please help me to solve syntax error.

0

There are 0 best solutions below