⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Database Syntax error Codeigniter Grocery Crud with SQLite



spsuresh54

spsuresh54
  • profile picture
  • Member

Posted 27 June 2020 - 06:28 AM

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.