» 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
gdfgf (787) 898-7655 80833 2016-08-02
JimmiXS (502) 479-6100 33008 2016-08-02
JimmiXS (765) 345-5068 28890 2016-08-10
m,nm (666) 000-0000 98989 2016-07-20
mohd (543) 217-6543 54321 2016-08-17
que pasa con esta cagada. (666) 555-6665 56031 2016-07-03
Shafie (123) 456-7890 43000 2016-08-31

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.


"Excellent!! Very Nice and simple!"

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.