» a PHP class to Create, Read, Update, & Delete from a mysql database table using AJAX

   by loud canvas media

Quick Links:

Quick Examples:

Modify Field With Class

Consider the following table:

CREATE TABLE tblFriend (
fldName varchar(25),
fldAddress varchar(30),
fldCity varchar(20),
fldState char(2),
fldZip varchar(5),
fldPhone varchar(15),
fldEmail varchar(35),
fldDateMet date,

NamePhoneZipDate We MetAction
-- -- -- 0000-00-00
Marcos Martins (111) 525-1411 04383 2017-10-05

Class Implementation:

---your class.php---

#required file and class
require_once ('preheader.php');
include_once ('ajaxCRUD.class.php')

#create an instance of the class
$tblFriend = new ajaxCRUD("Friend", "tblFriend", "pkFriendID");

//if we only want to show a few of the fields in the table
$tblFriend->showOnly("fldName, fldPhone, fldZip, fldDateMet");

#set the number of rows to display (per page)

#set a filter box at the top of the table
$tblFriend->addAjaxFilterBox('fldName', 20);

#modify field with class
#for masking and for adding calendar widget
$tblFriend->modifyFieldWithClass("fldDateMet", "datepicker");
$tblFriend->modifyFieldWithClass("fldZip", "zip");
$tblFriend->modifyFieldWithClass("fldPhone", "phone");

#show CSV export button

#order the table by any field you want
$tblFriend->addOrderBy("ORDER BY fldName");



// mask some fields with desired input mask
$("input.phone").mask("(999) 999-9999");

//put a date picker on a field
$( ".datepicker" ).datepicker({
	dateFormat: 'yy-mm-dd',
	showOn: "button",
		buttonImage: "includes/images/calendar.gif",
		buttonImageOnly: true,
	onClose: function(){

View Example by Itself

Click here to view example outside of the template.


"I just wanted to take the time to say I have been looking for an ajax table for months, I probably could have built one by now. Ive seen and Ive tried many different ajax tables and I have to say this ones by far the "BEST" out there! Thank you so much Loud Canvas Media. for all of your hard work. AWESOME! AWESOME! 5 stars."

What is a business/commercial website?

A commercial website is one created for a business, for which purpose is generating revenue or cash flow of any type (and that isn't under a non-profit organization). So if you're selling a product, selling advertisement, selling a service, or just marketing a commercial business, your site is commercial. A company website is also commercial even if it doesn't sell anything, as it's purpose is to front a commercial company.