ajaxCRUD.com

» a PHP class 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 class 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
ewre tertertertertert Cash ertertertertertert
I pray Everyday Credit Card 5j7j76
Biki2 Manó Credit Card OH NOES!
nice 123 Cash cool stuff
who knows kari Credit Card who knows


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;
# display headers as reasonable 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


Applications and websites coded in PHP run better with PHP hosting because it was specially designed for PHP technology.

 

"wow. that`s all I can say. Wow. I wish I had found this .... years ago.."
~Jake