Jump to content


Table name does not exist

tables

  • Please log in to reply
9 replies to this topic

#1 jorisvt

jorisvt

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 29 March 2012 - 08:51 PM

Hi,

I'm trying to get grocerycrud working, but I get this error:

Fatal error: Uncaught exception 'Exception' with message 'The table name does not exist. Please check you database and try again.' in C:\xampp2\htdocs\I-mprove\application\libraries\grocery_crud.php:3428 Stack trace: #0 C:\xampp2\htdocs\I-mprove\application\libraries\grocery_crud.php(3048): grocery_CRUD->get_table() #1 C:\xampp2\htdocs\I-mprove\application\controllers\examples.php(67): grocery_CRUD->render() #2 [internal function]: Examples->employees_management() #3 C:\xampp2\htdocs\I-mprove\system\core\CodeIgniter.php(359): call_user_func_array(Array, Array) #4 C:\xampp2\htdocs\I-mprove\index.php(202): require_once('C:\xampp2\htdoc...') #5 {main} thrown in C:\xampp2\htdocs\I-mprove\application\libraries\grocery_crud.php on line 3428

I've got the example tutorial working, but when I want to use my own database and tables I get the above error.


This is the function's code, which works with the tutorial data but not with my own custom data:
   $crud = new grocery_CRUD();
   $crud->set_table('products');
   $crud->set_subject('Product');
   $crud->unset_columns('productDescription');
   $crud->callback_column('buyPrice',array($this,'valueToEuro'));
  
   $output = $crud->render();
  
   $this->_example_output($output);

This is the code that gives the error:
   $crud = new grocery_CRUD();
   $crud->set_table('tblBranches');
   $crud->set_subject('brId');
   $crud->unset_columns('brName');
  
   $output = $crud->render();
  
   $this->_example_output($output);

If someone could help me that would be great!

#2 web-johnny

web-johnny

    grocery CRUD Author

  • Administrators
  • 969 posts
  • LocationLondon

Posted 29 March 2012 - 08:58 PM

Can you give as the result of:

echo "<pre>";
print_r($this->db->list_tables());
die();

Probably the table doesn't exist to your database or exist like that: tblbranches or tbl_Branches
Posted Image

#3 jorisvt

jorisvt

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 29 March 2012 - 09:11 PM

The tables and columns are there,

Result:
Array
(
    [0] => actor
    [1] => category
    [2] => customers
    [3] => employees
    [4] => film
    [5] => film_actor
    [6] => film_category
    [7] => lnkusergroups
    [8] => lnkusersfav
    [9] => offices
    [10] => orderdetails
    [11] => orders
    [12] => payments
    [13] => productlines
    [14] => products
    [15] => tblanalysis
    [16] => tblanswer
    [17] => tblaudits
    [18] => tblbranches
    [19] => tblcategory
    [20] => tblci_sessions
    [21] => tblcompanies
    [22] => tblfavorites
    [23] => tblgroups
    [24] => tblquestions
    [25] => tblroles
    [26] => tbltemplates
    [27] => tblusergroups
    [28] => tblusers
)


#4 web-johnny

web-johnny

    grocery CRUD Author

  • Administrators
  • 969 posts
  • LocationLondon

Posted 29 March 2012 - 09:39 PM

You have to add:
$crud->set_table("tblbranches");

and NOT
$crud->set_table("tblBranches");

The table name and the field names in mysql are case-insensitive
Posted Image

#5 jorisvt

jorisvt

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 30 March 2012 - 06:26 AM

That's it! I thought I tested that, but thanks anyway!

#6 bluepicaso

bluepicaso

    Member

  • Members
  • PipPip
  • 21 posts
  • LocationIndia

Posted 25 March 2013 - 04:36 PM

You have to add:

$crud->set_table("tblbranches");

and NOT
$crud->set_table("tblBranches");

The table name and the field names in mysql are case-insensitive

Solution is good, but a workaround, everything works fine on linux, but error is thrown on windows ONLY.
i use camel-casing for database tablestoo, this solution gets me error on linux now.


Harpreet Singh Bhatia
[web developer, programmer, entrepreneur]
Portfolio: TheCodingBox


Follow Me: facebook.png twitter.png googleplus.pngskype.png


#7 bluepicaso

bluepicaso

    Member

  • Members
  • PipPip
  • 21 posts
  • LocationIndia

Posted 02 April 2013 - 03:22 PM

Any good fix?


Harpreet Singh Bhatia
[web developer, programmer, entrepreneur]
Portfolio: TheCodingBox


Follow Me: facebook.png twitter.png googleplus.pngskype.png


#8 BalaPerdida

BalaPerdida

    Newbie

  • Members
  • Pip
  • 7 posts
  • LocationGranada, Spain

Posted 10 April 2013 - 10:34 PM

Hi guys:

 

this is my first code in CRUDE:

 

 

function index()
    {
        $this->load->library('grocery_CRUD');
        $crud = new grocery_CRUD();
        $crud->set_table("hermanos");
        $crud->columns('nombre','apellidos','direccion','poblacion','provincia','telefono','movil','email');
        
        echo "<pre>";
        print_r($this->db->list_tables());
        
        
        $output = $crud->render();
        
        $this->_example_output($output);        
    }

 

And I get this:

 

Array
(
[0] => conceptos_pago
[1] => cuentas
[2] => documentos
[3] => grupos
[4] => hermanos
[5] => hermanos_grupos
[6] => history
[7] => modulos_usuarios
[8] => oficios
[9] => pagos
[10] => procesion_oficios_hermanos
[11] => salidas_procesionales
[12] => users
[13] => vw_hermanos_activos
[14] => vw_hermanos_grupos
[15] => vw_hermanos_inactivos
[16] => vw_listado_hermanos_activos
[17] => vw_users
)


Fatal error: Call to undefined method Prueba::_example_output() in /home/[xxxx]/public_html/[xxxx]/[xxxx]/application/controllers/prueba.php on line 26

 

any idea?

 

Thanks!!



#9 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 11 April 2013 - 05:16 AM

As the message says you haven't got the _example_output function. Copy from here, http://www.grocerycr...l_basic_methods


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#10 ramflores

ramflores

    Newbie

  • Members
  • Pip
  • 1 posts
  • LocationMèxico

Posted 14 February 2017 - 05:57 PM

Hello, I'm from Mexico

 

Excuse my translation

I use codeigniter 3, on a ubuntu server 16, pointing to a SQL server database, and do the adaptations they mention, but still, it tells me that the table does not exist, but if it is in the array ()

 

 

Array
(
[0] => Equipo_Tipo_Eje
[1] => PLety_Area_Login
[2] => PLety_Areas
[3] => PLety_Login_NoSAP
[4] => PLety_Notifica
[5] => PLety_Plan_Notifica
[6] => PLety_Preventivos_Realizados

 

 

The table name does not exist. Please check you database and try again. ---

#0 /var/www/html/letynet/application/libraries/Grocery_CRUD.php(4420): Grocery_CRUD->get_table()

#1 /var/www/html/letynet/application/libraries/Grocery_CRUD.php(4436): Grocery_CRUD->pre_render()

#2 /var/www/html/letynet/application/controllers/Simet.php(609): Grocery_CRUD->render()

#3 /var/www/html/letynet/system/core/CodeIgniter.php(532): Simet->plan_notifica()

#4 /var/www/html/letynet/index.php(315): require_once('/var/www/html/l...')

#5 {main}

 

Hello, I'm from Mexico


Gracias de antemano

-------------------------------------------

Ing. Ramiro Flores

DIOS los bendiga






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users