Hello,

I am new to drupal and its my first site.I am trying to make site which should let me view,add and update the database table records.

This is the approach i followed (Please help me if i am going in wrong direction :) )
1.Used the table wizard module and created the view to display the database table.
2.View is displaying the database table content successfully.

To add the CRUD operations i tried the following things :-
1)Tried using EditView module but when i create clone of my view i don't get the view type option Edit View.
2)Installed the Helper module which contains helper functions for database for CRUD operations but couldn't understand how to use or call these helper functions.
3)Thought of creating a form instead of table to enter the values found certain modules like form builder but its description says it is good only for entering the values as its not a stable API.
4)Any other suggestions are welcome :-)

Please suggest me how can i implement CRUD operations in the best way.

Thanks in Advance.

Comments

WorldFallz’s picture

afaik, if editview doesn't work you'll have to code the crud operations yourself.

Jaspreet Kaur’s picture

Thanks alot.

I have installed the EditView module (already have the views module).Is there something i am missing due to which the EditView module is not even showing up in the administer page.

Thank You.

_rune’s picture

Hi Jaspreet

I have just released the first stable version of Auto Admin - a module that supplies CRUD operations for tables.

If you have Drush installed, the following shell commands are all you need to have CRUD going:

drush dl autoadmin schema
drush enable autoadmin
drush autoadmin generate [MODULE] [TABLE 1] [TABLE 2] ... [TABLE N] --write --yes

Then browse to "admin/content" and enjoy your hard work:)

fcedillo’s picture

_rune:

cant autoadmin serve the crud functionality for one table on a local database different to drupal database?

best regards.

_rune’s picture

Hi Franco

Not at the moment, but that should be doable using the db_set_active(). Something like:

function autoadmin_init_page($table) {
drupal_add_css(AUTOADMIN_PATH . '/autoadmin.css');
$schema = autoadmin_schema_get_one($table);
db_set_active($schema['database']);
autoadmin_session_check_for_reset($schema);
drupal_set_title(theme('autoadmin_description', $schema));
return $schema;
}

And then it should switch back to default at the end of autoadmin_list(), autoadmin_edit_form() and autoadmin_delete_confirm().

You would also need to add something like a "--database" option to the drush commands.

Ohh, and tests should also be added :)

Am insanely busy these days but patches are welcome :)

Cheers
Rune