ajaxCRUD.com

» a PHP API to create / read / update / delete from a database table using AJAX

   by loud canvas media

Quick Links:

Quick Examples:



www.allthewebsites.org

What is AjaxCRUD?

AjaxCRUD is an open-source PHP API which allows you to connect to a mySQL database and easily perform the necessary CRUD operations (create, read, update, & delete rows).

Please explain...

Have you ever needed to get easy access to a database table and you don't have the time to code all the necessary actions you need (add rows, edit a row, delete a row...)?

This PHP class allows you to get the access you need without spending the time and energy on lengthy coding.


Give me an Example

Consider the following table:

    CREATE TABLE tblCustomer(
    pkCustomerID INT PRIMARY KEY AUTO_INCREMENT,
    fldFName VARCHAR(40),
    fldLName VARCHAR(40),
    fldPaysBy VARCHAR(20),
    fldDescription TEXT
    );

Now see the API work in action:
(try adding, editing (clicking on the field), or deleting a record)


First:
FirstLastPays ByCustomer InfoAction
roman lescano Paypal customer info
Kai Hansen Cash Dr Stein
test test Credit Card test
William Sam Cash I've been looking for freedom...


Please do not post web-links of any kind.


Hundreds of other styles available at http://icant.co.uk/csstablegallery

(View Demo outside template)

How did you do that?

Just a few lines of code:


# the code for the class
include ('ajaxCRUD.class.php');

# this one line of code is how you implement the class
$tblCustomer = new AjaxCRUD("Customer",
                             "tblCustomer", "pkCustomerID");

# don't show the primary key in the table
$tblCustomer->omitPrimaryKey();

# my db fields all have prefixes;
# make them display an readable titles
$tblCustomer->displayAs("fldFName", "First");
$tblCustomer->displayAs("fldLName", "Last");
$tblCustomer->displayAs("fldPaysBy", "Pays By");
$tblCustomer->displayAs("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)
$values = array("Cash", "Credit Card", "Paypal");
$tblCustomer->defineAllowableValues("fldPaysBy", $values);

# add the filter box (above the table)
$tblCustomer->addAjaxFilterBox("fldFName");

# actually show to the table
$tblCustomer->showTable();

Ok, I'm sold. Let me try it out!

» Download the code
» Leave a Comment
» View the API Reference Material
» View Demo outside template