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:


Create a Relationship Example


Consider the following tables (and SQL insert statements):

	CREATE TABLE tblGenres(
	pkGenreID INT PRIMARY KEY AUTO_INCREMENT,
	fldGenre VARCHAR(40)
	);

	CREATE TABLE tblMyMp3CollectionDemo2(
	pkMP3ID INT PRIMARY KEY AUTO_INCREMENT,
	fldFilename VARCHAR(150),
	fldTitle VARCHAR(60),
	fldArtist VARCHAR(60),
	fkGenreID INT
	);

	INSERT INTO tblGenres (fldGenre) VALUES ("Rock");
	INSERT INTO tblGenres (fldGenre) VALUES ("Pop");
	INSERT INTO tblGenres (fldGenre) VALUES ("Euro Trash");
	INSERT INTO tblGenres (fldGenre) VALUES ("Sweedish HipHop");



fldFilenamefldTitlefldArtistfkGenreIDAction
SDASD ASDAD SADASD Sweedish HipHop
6666 rockit solaris Euro Trash
3513 32132 5434 Rock

Class Implementation:


#include the class
include ('ajaxCRUD.class.php');

#this one line of code is how you implement the class
$tblDemo = new ajaxCRUD(
	"MP3 File", "tblMyMp3CollectionDemo2", "pkMP3ID");

$tblDemo->defineRelationship("fkGenreID", "tblGenres", "pkGenreID",
"fldGenre");

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

View Example by Itself

Click here to view example outside of the template.

Recent Feedback

"Looks efficient. I`m going to go try it out..." - Posted by Jason R on Friday Jul 11th, 2008 at 4:32pm

"Just perfect ..." - Posted by Besmir S on Thursday Jul 17th, 2008 at 7:51pm

"Perfect. I`m go try it

Amigo
" - Posted by Horacio from méxico on Tuesday Aug 12th, 2008 at 3:23pm

"comment3, " - Posted by jonn2 on Saturday Nov 8th, 2008 at 12:22am

"its so cool...." - Posted by martin on Friday Mar 13th, 2009 at 4:27pm

"This is a very useful tool!!!
Are you still working on it?
" - Posted by Omar on Monday May 11th, 2009 at 1:03am

"Sweet!!! One of the few packages that runs right out of the box. Just modify a couple of lines database.php, it runs perfectly. Can`t wait to look at the code." - Posted by Mike on Thursday Jun 4th, 2009 at 9:27pm

"Excellent!! Very Nice and simple!" - Posted by Bahassine on Monday Oct 5th, 2009 at 12:49pm

"Is there a way to define two or Join more than 2 tables?" - Posted by Roger on Sunday Nov 29th, 2009 at 11:17pm

"There are bug in IE." - Posted by Ali on Friday Dec 4th, 2009 at 3:15am

Leave a Comment

Your Name      
Your Email   
Comment

 

"Great api. Really love the demo. "
~Ade

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