ajaxCRUD.com
» a PHP API to create / read / update / delete from a database table using AJAX
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) );
| fldFilename | fldTitle | fldArtist | fldGenre |
|---|---|---|---|
| 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