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

   by loud canvas media

Quick Links:

Quick Examples:

Images in Table

Consider the following table:

  `id` int(11) NOT NULL auto_increment,
  `playoffs` varchar(20) default NULL,
  `logo` text,
  `name` varchar(60) default NULL,
  `founded` int(11) default NULL,
  `description` text,
  PRIMARY KEY  (`id`)

View Insert SQL Statements

NoBoston Celtics1947The Boston Celtics is a professional basketball team based in Boston, Massachusetts, playing in the Atlantic Division of the Eastern Conference in the National Basketball Association (NBA). The team is owned by Wycliffe Grousbeck and coached by Doc Rivers, with Danny Ainge as the President of Basketball Operations. Founded in 1946, their 17 NBA Championships are the most for any NBA franchise
NoCleveland Cavaliers1970
NoChicago Bulls1966The Chicago Bulls are an American professional basketball team based in Chicago, Illinois, playing in the Central Division of the Eastern Conference in the National Basketball Association (NBA). The team was founded in 1966. They play their home games at the United Center. The team is well known for having one of the greatest dynasties in NBA history during the 1990s, winning six championships in 8 years with two three-peats. All six of those championship teams were led by Michael Jordan, Scottie Pippen and coach Phil Jackson.
NoMilwaukee Bucks1968The Milwaukee Bucks are a professional basketball team based in Milwaukee, Wisconsin. They play in the National Basketball Association (NBA). The current franchise owner is U.S. Senator Herb Kohl.

Class Implementation:

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

#this one line of code is how you implement the class
$tblDemo = new ajaxCRUD("NBA Team", "tblNBA", "id");


$tblDemo->displayAs("playoffs", "Playoffs");
$tblDemo->displayAs("logo", "Logo");
$tblDemo->displayAs("name", "Name");
$tblDemo->displayAs("founded", "Founded");
$tblDemo->displayAs("description", "Description");

#define that a field if a checkbox

#add an ajax filter box

#formatFieldWithFunction is a powerful method
$tblDemo->formatFieldWithFunction('logo', 'makeImg');
$tblDemo->formatFieldWithFunction('name', 'makeUnderline');

#don't allow table editing

#don't allow table adding

#don't allow deleting of rows

#actually show the table

function makeUnderline($val){
	return "<u>$val</u>";

function makeImg($val){
	return "<img src=\"$val\" width=\"100\" />";

View Example by Itself

Click here to view example outside of the template.


"Great api. Really love the demo. "

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.