ajaxCRUD.com
» a PHP API to create / read / update / delete from a database table using AJAX
by loud canvas mediaQuick Links:
Quick Examples:
- Creating a Relationship
- File Uploading
- Using a Where Clause
- Defining Allowable Input
- Formatting Fields With Function
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) );
| fldFilename | fldTitle | fldArtist | fldGenre |
|---|---|---|---|
| asd | asdasd | Pop | |
| Pop | |||
| poppy.mp3 | sdffffffffffffffffffffffffffffffffffffffffffffffffff | gsdfgsdfgsdfgsdfgsdfg | 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'");
$allowable_vals = array("Pop", "Rock", "Country", "Blues");
$tblDemo->defineAllowableValues("fldGenre", $allowable_vals);
#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.
Recent Feedback
"Hello. And Bye." - Posted by XRumerTest on Sunday May 3rd, 2009 at 8:58pm
"Hello. And Bye." - Posted by XRumerTest on Monday May 4th, 2009 at 3:23am
"first of all: great work! thanx for this class!!
please give me a tip: when generating a new record i want to see the input form on top of the window. is this possible?!
have a nice weekend - i`m greeting from muenster - a town in the middel-west of germany. it rains.........
cordially,
wolga
" - Posted by wolga wibri on Friday May 8th, 2009 at 3:27am
please give me a tip: when generating a new record i want to see the input form on top of the window. is this possible?!
have a nice weekend - i`m greeting from muenster - a town in the middel-west of germany. it rains.........
cordially,
wolga
" - Posted by wolga wibri on Friday May 8th, 2009 at 3:27am
"Great post! I`ll subscribe right now wth my feedreader software!" - Posted by JaneRadriges on Saturday Jun 13th, 2009 at 11:34pm
"The best information i have found exactly here. Keep going Thank you" - Posted by KattyBlackyard on Monday Jun 15th, 2009 at 12:08am
Leave a Comment
"I love AjaxCRUD! It's saved me hours upon hours of typing!"
~Eric Duwenhoegger
"AjaxCRUD is wonderful."
~Peter Barone
