ajaxCRUD.com

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

   by loud canvas media

Quick Links:

Quick Examples:


Show Checkbox - All


Consider the following table:


CREATE TABLE tblDemo(
pkID INT PRIMARY KEY AUTO_INCREMENT,
fldField1 VARCHAR(45),
fldField2 VARCHAR(45),
fldCertainFields VARCHAR(40),
fldLongField TEXT
);



fldField1fldField2fldCertainFieldsfldLongField
Allowable Value 1 HOLA
Allowable Value 1 SOY
CRUD TU MADRE

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("Item", "tblDemo", "pkID");

$tblDemo->omitPrimaryKey();

#define our checkboxes
$tblDemo->defineCheckbox('fldField1','on','off');
$tblDemo->defineCheckbox('fldField2','on','off');

#show header checkboxes
$tblDemo->showCheckboxAll('fldField1', true);
$tblDemo->showCheckboxAll('fldField2', true);

#for heck of it, only certain fields are allowed for fldCertainFields
$allowableValues = array("Allowable Value 1", "Allowable Value2",
                                             "Dropdown Value", "CRUD");
$tblDemo->defineAllowableValues("fldCertainFields", $allowableValues);

#disallow adding and deleting rows
$tblDemo->disallowDelete();
$tblDemo->disallowAdd();

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

Read API Documentation on this function here.

View Example by Itself

Click here to view example outside of the template.

 

"Brilliant. Saved insane amounts of time. `nuff said."
~Soule

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.
Close