Jump to content


Database Syntax error Codeigniter Grocery Crud with SQLite

php sqlite grocery crud codeigniior

  • Please log in to reply
No replies to this topic

#1 spsuresh54

spsuresh54

    Newbie

  • Members
  • Pip
  • 1 posts

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/s..._crud_model.php

Please help me to solve syntax error.

 

 







Also tagged with one or more of these keywords: php, sqlite, grocery crud, codeigniior

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users