⚠ 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

Table name does not exist



jorisvt

jorisvt
  • profile picture
  • Member

Posted 29 March 2012 - 20: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!

web-johnny

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 29 March 2012 - 20: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

jorisvt

jorisvt
  • profile picture
  • Member

Posted 29 March 2012 - 21: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
)

web-johnny

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 29 March 2012 - 21: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

jorisvt

jorisvt
  • profile picture
  • Member

Posted 30 March 2012 - 06:26 AM

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

bluepicaso

bluepicaso
  • profile picture
  • Member

Posted 25 March 2013 - 16: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.


bluepicaso

bluepicaso
  • profile picture
  • Member

Posted 02 April 2013 - 15:22 PM

Any good fix?


BalaPerdida

BalaPerdida
  • profile picture
  • Member

Posted 10 April 2013 - 22: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!!


davidoster

davidoster
  • profile picture
  • Member

Posted 11 April 2013 - 05:16 AM

As the message says you haven't got the _example_output function. Copy from here, http://www.grocerycrud.com/documentation/tutorial_basic_methods


ramflores

ramflores
  • profile picture
  • Member

Posted 14 February 2017 - 17: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