ajaxCRUD.com

» a PHP API to create / read / update / delete from a database table using AJAX

Quick Links:

Quick Examples:



www.allthewebsites.org

Add Where Clause


Consider the following table:


	CREATE TABLE tblMyMp3CollectionDemo(
	pkMP3ID INT PRIMARY KEY AUTO_INCREMENT,
	fldFilename VARCHAR(150),
	fldTitle VARCHAR(60),
	fldArtist VARCHAR(60),
	fldGenre VARCHAR(40)
	);



fldFilenamefldTitlefldArtistfldGenre
fsdòò scs csd Pop

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",
      "tblMyMp3CollectionDemo", "pkMP3ID");

$tblDemo->omitPrimaryKey();

#add the sql where clause
$tblDemo->addWhereClause("WHERE fldGenre = 'Pop'");

#don't allow deleting of rows
$tblDemo->disallowDelete();

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

View Example by Itself

Click here to view example outside of the template.

Leave a Comment

Your Name      
Your Email   
Comment