I recently discovered an Ajax CRUD library which makes CRUD operations positively painless: AjaxCRUD

Its features include:

– displaying list in an inline-editable table
– generates a create form
– all operations (add,edit,delete) handled via ajax
– supports 1:many relations
– only 1 class to include!!

I highly recommend you try it out!

Here is the example code:

# the code for the class

# this one line of code is how you implement the class
                             "tblCustomer", "pkCustomerID");

# don't show the primary key in the table
# my db fields all have prefixes;
# display headers as reasonable titles
"fldFName", "First""fldLName", "Last""fldPaysBy", "Pays By""fldDescription", "Customer Info");

# set the height for my textarea
$tblCustomer->setTextareaHeight('fldDescription', 100);

# define allowable fields for my dropdown fields
# (this can also be done for a pk/fk relationship)
"Cash", "Credit Card", "Paypal""fldPaysBy", $values);

# add the filter box (above the table)

# actually show to the table