php - Code Igniter GroceryCRUD Tutorial Fata Exception Table DOes Not Exist -


i'm new code igniter , grocerycrud. after basic installation , verification created database tables , began following newbie tutorial located here.

http://www.grocerycrud.com/documentation/create-crud-codeigniter-tutorial

fatal error: uncaught exception exception message table name not exist. please check database , try again. in /library/webserver/documents/application/libraries/grocery_crud.php:4349 stack trace: #0 /library/webserver/documents/application/libraries/grocery_crud.php(3875): grocery_crud->get_table() #1 /library/webserver/documents/application/libraries/grocery_crud.php(3891): grocery_crud->pre_render() #2  /library/webserver/documents/application/controllers/main.php(27): grocery_crud->render() #3 [internal function]: main->employees() #4 /library/webserver/documents/system/core/codeigniter.php(359): call_user_func_array(array, array) #5 /library/webserver/documents/index.php(202): require_once(/library/webser...) #6 {main} thrown in /library/webserver/documents/application/libraries/grocery_crud.php on line 4349 

i'm getting table not exist , when modify main.php display table list

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

i empty array back. think maybe wrong mysql user configured, somehow database not getting selected although database connection successful (or bomb out earlier in initialization process).

my configuration

mac osx 10.7.5

database.php

$active_group = 'default'; $active_record = true;  $db['default']['hostname'] = 'localhost'; $db['default']['username'] = 'cruduser'; $db['default']['password'] = 'foo45bar'; $db['default']['database'] = 'crud'; $db['default']['dbdriver'] = 'mysql'; $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = true; $db['default']['db_debug'] = false; $db['default']['cache_on'] = false; $db['default']['cachedir'] = ''; $db['default']['char_set'] = 'utf8'; $db['default']['dbcollat'] = 'utf8_general_ci'; $db['default']['swap_pre'] = ''; $db['default']['autoinit'] = true; $db['default']['stricton'] = false; 

the result of $this->db->list_tables()); in main.php

welcome world of codeigniter

array ( ) 

select of mysql user table

mysql> select host,user  mysql.user; +-----------+----------+ | host      | user     | +-----------+----------+ | %         | cruduser | | localhost | root     | +-----------+----------+ 2 rows in set (0.00 sec) 

show databases in mysql

mysql> show databases; +--------------------+ | database           | +--------------------+ | information_schema | | crud               | | mysql              | | performance_schema | +--------------------+ 4 rows in set (0.00 sec) 

show tables in 'crud' database

mysql> show tables; +----------------+ | tables_in_crud | +----------------+ | actor          | | category       | | customers      | | employees      | | film           | | film_actor     | | film_category  | | offices        | | orderdetails   | | orders         | | payments       | | productlines   | | products       | +----------------+ 13 rows in set (0.00 sec) 

source main.php

<?php  if ( ! defined('basepath')) exit('no direct script access allowed');  class main extends ci_controller {      function __construct()     {         parent::__construct();          /* standard libraries of codeigniter required */         $this->load->database();         $this->load->helper('url');         /* ------------------ */          $this->load->library('grocery_crud');      }      public function index()     {         echo "<h1>welcome world of codeigniter</h1>";//just example ensure function   echo "<pre>"; print_r($this->db->list_tables()); die(); }      public function employees()     {         $this->grocery_crud->set_table('employees');         $output = $this->grocery_crud->render();          echo "<pre>";         print_r($output);         echo "</pre>";         die();     } } 

the answer on stack overflow in message codeigniter: unable connect database server using provided settings error message

the problem on osx /private/etc/php.ini.default must edited , saved php.ini change property pointing /var/mysql/mysql.sock in osx, file located in /tmp/mysql.sock.

change this

mysql.default_socket = /var/mysql/mysql.sock 

to this

mysql.default_socket = /tmp/mysql.sock 

and bounce apache

george


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -