ajaxCRUD.com
» a PHP class to Create, Read, Update, & Delete from a mysql 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
- Vertical Display
- Show Header Checkbox
- Modify Field with Class
FAQs
| Question | asasd |
|---|---|
| Answer | g hd f g hdfhgghfh fgasdgf sdgf sdgfs dfgs dgfsdf gsdfg sdgf sgfs dgfsdgf sdfgs gfsgsdfg sdfgs gfsd sgdg sdgfs dgfs dgf sdgfs dgfs gf sdgfs dgfsd gsdf sdfg sdfg sdfgs dgfsd gsdg sdgfs dgfsdf sdfg sdf... |
| Sort Order | 25 |
| Action | |
Code to Create The Table Above:
$tblFAQ = new ajaxCRUD("FAQ", "tblFAQ", "pkFAQID");
#displays
$tblFAQ->displayAs("fldQuestion", "Question");
$tblFAQ->displayAs("fldAnswer", "Answer");
$tblFAQ->displayAs("fldSort", "Sort Order");
$tblFAQ->omitPrimaryKey();
#order by fldSort
$tblFAQ->addOrderBy("ORDER BY fldSort");
#set some textbox heights
$tblFAQ->setTextareaHeight('fldQuestion', 50);
$tblFAQ->setTextareaHeight('fldAnswer', 125);
#abbreviate the text for the display (no impact on edit)
$tblFAQ->formatFieldWithFunction("fldAnswer", "abbrivText");
#actually show to the table
$tblFAQ->showTable();
#the callback function to abbreviate the answer text
function abbrivText($text){
return substr($text, 0, 200) . "...";
}
"I love ajaxCRUD! It's saved me hours upon hours of typing!"
~Eric Duwenhoegger
