ajaxCRUD.com
» a PHP class to create / read / update / delete from a database table using AJAX
by loud canvas mediaQuick Links:
Quick Examples:
- Displaying Images
- Creating a Relationship
- File Uploading
- Using a Where Clause
- Defining Allowable Input
- Formatting a Field With a Function
- Show Header Checkbox
www.allthewebsites.org
File Upload Example
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 | Action |
|---|---|---|---|---|
| 1 (edit delete) | 1 | 1 | Rock | |
| Add File | Rock | |||
| test (edit delete) | mp | aman | Country | |
| Add File | alex sintek | Pop | ||
| Add File | Pop | |||
| ad (edit delete) | ad | ad | Country | |
| ad (edit delete) | sd | f3 | Rock | |
| 1.mp3 (edit delete) | come together | hale | Blues | |
| 2 (edit delete) | 2 | 2 | Trance | |
| ad (edit delete) | sd | hola | Pop | |
| Add File | dasdsa | asdadasd | Rock | |
| Add File | f | f | Rock | |
| Add File | hvj | bkbkbbk |
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();
$tblDemo->setFileUpload("fldFilename", "uploads/");
$allowable_vals = array("Rock", "Euro Pop", "Trance", "HipHop");
$tblDemo->defineAllowableValues("fldGenre", $allowable_vals);
#actually show to the table
$tblDemo->showTable();
View Example by Itself
Click here to view example outside of the template.
Recent Feedback
"OMG! This is just what I was looking for. Thanks so much. This is amazing!" - Posted by Simone on Friday Jul 11th, 2008 at 4:34pm
"Sorry all -- had to disable uploading due to hacking attempts. Feel free to try out on your own server though!" - Posted by Sean Dempsey on Sunday Sep 14th, 2008 at 7:23pm
"comment2, " - Posted by jonn2 on Sunday Nov 9th, 2008 at 6:21am
"awesome it is best
working fine
thanks" - Posted by fakhru on Tuesday Dec 16th, 2008 at 5:28am
working fine
thanks" - Posted by fakhru on Tuesday Dec 16th, 2008 at 5:28am
"ajaxCRUD.class.php on line 1238" - Posted by Juan Carlos on Monday Jan 19th, 2009 at 4:32pm
"just what i looked for..." - Posted by Sergey on Wednesday Mar 25th, 2009 at 11:02am
"I can`t wait to give this a try." - Posted by Fortin on Thursday Mar 26th, 2009 at 3:58pm
"I can`t wait to give this a try." - Posted by Fortin on Thursday Mar 26th, 2009 at 3:59pm
Leave a Comment
"Brilliant. Saved insane amounts of time. `nuff said."
~Soule
