I have setup a controller with a GC table and when I try to to add a row, it generates an error:
An error has occurred on insert
Then I tried to EDIT an existing row and got an error like the following:
An error has occurred on saving.
Now I am ecstatic that error messages are generated from GC, I am not sure why I am not able to do these simple actions.
I assume it has something to do with a mySQL error.
Can someone recommend how to get more data to display for me to allow me to DEBUG my script. i.e. ECHO mySQL string, etc...
Thanks!
Debugging ADD and EDIT errors
- Single Page
Posted 01 March 2014 - 16:10 PM
Posted 02 March 2014 - 21:08 PM
Well a possible way to perform such debuging may be using the CI profiler
$this->output->enable_profiler(TRUE);
try and see if it can help you...
Else u are recommended to post in your code / table structure... so that in case there is error in code - some1 may help u fix it.
Posted 20 May 2014 - 11:31 AM
Well a possible way to perform such debuging may be using the CI profiler
$this->output->enable_profiler(TRUE);
try and see if it can help you...
Else u are recommended to post in your code / table structure... so that in case there is error in code - some1 may help u fix it.
this line goes where?
view? controller?
Posted 20 May 2014 - 12:09 PM
Tried Amish's solution with no luck :( i'm having the same error.
posted it on StackOverflow to not repeat the same thread in this forum:
http://stackoverflow.com/questions/23759240/grocery-crud-how-to-debug-add-edit-errors
Posted 20 May 2014 - 20:19 PM
well this wont solve yr problem but avail u information as to identify what and where is the error / problem. I will recommend the CI mode to be in developer mode rather then being production. With this, it will help u identify any sort of errors if at all available. And whatever errors if such dose get generated it will be printed out in the output / response. U might be able to view the same using firebug.
Hope this instructions help u reach to the root cause of your problem.. Else - do 1 thing share the tables ddl and the code of the controller .. and we might try and understand as where and what the error is .!
Posted 21 May 2014 - 11:24 AM
Good! i solved it!
Gonna post a new thread with my solution and steps followed
Posted 21 May 2014 - 11:43 AM
@dwdc. in order to debug the SQL code, i suggest you this:
1. define a callback function after insert inside your controller:
$crud->callback_after_insert(array($this, 'after_insert_callback'));
2. then, inside the callback function, display the last SQL query done against the DB:
after_insert_callback($post_array,$primary_key)
3. don't forget to enable logging output to be able to see it:
you need to set write permissions on the logs/ folder
chmod a+w logs/
and also, inside /application/config/config.php, set:
$config['log_threshold'] = 2;
to enable debug output
hope it helps!