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
Define Allowable Values Example
Consider the following table:
CREATE TABLE tblDemo(
pkID INT PRIMARY KEY AUTO_INCREMENT,
fldField1 VARCHAR(40),
fldField2 VARCHAR(40),
fldField3 VARCHAR(40),
fldCertainFields VARCHAR(40),
fldLongField TEXT
);
No data in this table. Click add button below.
Class Implementation:
#include the class
include ('ajaxCRUD.class.php');
#this one line of code is how you implement the class
$tblDemo = new ajaxCRUD("New Item", "tblDemo", "pkID");
$tblDemo->omitPrimaryKey();
$allowable_vals = array("My Awesome Value",
"This is another Value",
"NEW Value", "OLD Value");
$tblDemo->defineAllowableValues("fldCertainValues",
$allowable_vals);
#actually show to the table
$tblDemo->showTable();
View Example by Itself
Click here to view example outside of the template.
Recent Feedback
"I got a problem, russion input text now work cortctly
after submiting form i get like something :
%u0442%u0435%u0441%u0442 %u0435%u0441%u0442
Help! =)
" - Posted by Yuri on Sunday Jul 27th, 2008 at 9:54am
after submiting form i get like something :
%u0442%u0435%u0441%u0442 %u0435%u0441%u0442
Help! =)
" - Posted by Yuri on Sunday Jul 27th, 2008 at 9:54am
" Any/all issues/bugs/questions will be answered in the only forum: http://www.ajaxcrud.com/forum/viewforum.php?f=2" - Posted by Sean Dempsey on Monday Oct 6th, 2008 at 12:45am
"ldakympvg vucxh ubysm sonb ukgtms bniptexf bkvz" - Posted by fzsr huzebk on Tuesday Sep 23rd, 2008 at 8:51pm
"
Great api. Really love the demo.
I`ve just spent the better part of the morning installing it for use in my application. So far, so good.
There is a problem with the input saving to my database however. It calls up my database table fields fine, I enter the information but it doesn`t save to my database and the webpage shows a broken/empty icon where my information should be displayed.
Can you help me with this issue, please." - Posted by Ade on Tuesday Nov 11th, 2008 at 8:42am
Great api. Really love the demo.
I`ve just spent the better part of the morning installing it for use in my application. So far, so good.
There is a problem with the input saving to my database however. It calls up my database table fields fine, I enter the information but it doesn`t save to my database and the webpage shows a broken/empty icon where my information should be displayed.
Can you help me with this issue, please." - Posted by Ade on Tuesday Nov 11th, 2008 at 8:42am
"really its cool i hope best to all am really always searching at new technique i hope to all team best regards" - Posted by web developer on Saturday Nov 22nd, 2008 at 10:36pm
"As it is not possible to come with bug report without registering in your forum, your getting it here :) Maybe someone else will take this into the forum?
Anywho, GREEEAT functions! Easily understandable code, I`m loooovving it :D
I did fell over a tiny bug on this page. If you click to edit a text field, and do not change anything and press enter, it comes with an error "Error updating content". It should be clever enough to see, that nothing`s changed and then go on with it anywho - updating or not updating, but there`s no error :)
Great work!" - Posted by Svend Koustrup on Saturday Mar 7th, 2009 at 7:04am
Anywho, GREEEAT functions! Easily understandable code, I`m loooovving it :D
I did fell over a tiny bug on this page. If you click to edit a text field, and do not change anything and press enter, it comes with an error "Error updating content". It should be clever enough to see, that nothing`s changed and then go on with it anywho - updating or not updating, but there`s no error :)
Great work!" - Posted by Svend Koustrup on Saturday Mar 7th, 2009 at 7:04am
"hi,
this is awesome men, just one more thought, how about relationship between 3 or more tables?
thanks" - Posted by jing tuibeo on Sunday Oct 11th, 2009 at 2:24am
this is awesome men, just one more thought, how about relationship between 3 or more tables?
thanks" - Posted by jing tuibeo on Sunday Oct 11th, 2009 at 2:24am
"hi,
i am having problem in putting date in dd/mm/yyyy format as mysql accept it in yyyy-dd-mm so all my date field shows as 0000-00-00.
Please give me the link if the problem is already solved.
i tried following code but did not worked
$tblDemo->onAddExecuteCallBackFunction("newdate1");
function newdate1($array){
$caseID = $array[id];
//
$caseDate = $array[caseDate];
$aDate = explode(`/`,$caseDate);
$newDate = $aDate[2].`-`.$aDate[1].`-`.$aDate[0] ;
//
$caseDateName = $array[caseDate];
$success = qr("UPDATE cases SET caseDate = $newDate WHERE id = $caseID");
echo $success;
} " - Posted by gunjan kumar on Thursday Feb 11th, 2010 at 1:59am
i am having problem in putting date in dd/mm/yyyy format as mysql accept it in yyyy-dd-mm so all my date field shows as 0000-00-00.
Please give me the link if the problem is already solved.
i tried following code but did not worked
$tblDemo->onAddExecuteCallBackFunction("newdate1");
function newdate1($array){
$caseID = $array[id];
//
$caseDate = $array[caseDate];
$aDate = explode(`/`,$caseDate);
$newDate = $aDate[2].`-`.$aDate[1].`-`.$aDate[0] ;
//
$caseDateName = $array[caseDate];
$success = qr("UPDATE cases SET caseDate = $newDate WHERE id = $caseID");
echo $success;
} " - Posted by gunjan kumar on Thursday Feb 11th, 2010 at 1:59am
"Brilliant.
Saved insane amounts of time.
`nuff said." - Posted by Soule on Sunday Mar 28th, 2010 at 8:58am
Saved insane amounts of time.
`nuff said." - Posted by Soule on Sunday Mar 28th, 2010 at 8:58am
Leave a Comment
"...first of all great work! :) Really smooth operation and deployment."
~Jonathan

(did you have this years ago...? haha)" - Posted by Jake on Wednesday Jul 16th, 2008 at 10:08pm