How can I have multiple tables without making a new Editor.php file?
How can I have multiple tables without making a new Editor.php file?
I am hoping to have around 10-15 tables setup. Whenever I Add my own data from mysql I get a response saying "could not find 'id' in fieldlist". So to work around this I replace 'id' with the name of my primary key in the 'Editor.php' file. I think its obvious that replicating the file multiple times in a different directory sounds awful. Is there an easy way to do this? Forgive me if this is an extremely nooby question I am just being introduced to jquery as well as this plugin. Surely there is something easy that is flying by my head!
Answers
It would help a lot if you could post the contens of Editor.php. Either way, Implementing the back-end is out of datatables' scope.
Personally, I would place the revelant code on an generic include file (it could be named Editor.php), but instead of fixing on one primary key value, I would assume its value would be in some variable (say $pk) . Later on, for each table I'd need, I would create a file, which would define the variable $pk (and any other needed) and include the generic code. It would then look something like this:
The
Editor.php
file is probably the one that comes with the Editor PHP download.@jmack44 - If you want one shared file for all tables, I'd suggest something like this:
Then for your DataTables and Editor
ajax
urls add?table=staff
or?table=customers
.Allan