ajaxCRUD.com

» a PHP class to Create, Read, Update, & Delete from a mysql database table using AJAX

   by loud canvas media

Quick Links:

Quick Examples:


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
    );


fldField1fldField2fldCertainFieldsfldLongFieldAction
-- ssss NEW Value --
azer qsdf rtyu fghj
-- -- OLD Value asdasdasd
kjkjkkjjkjka llkklj  --  --
-- -- NEW Value --
-- --  --  --

Class Implementation:


#required file and class
require_once ('preheader.php');
include_once ('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

"wow. that`s all I can say. Wow. I wish I had found this .... years ago..

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

"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

" 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

"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

"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

"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

"Brilliant.
Saved insane amounts of time.
`nuff said.
" - Posted by Soule on Sunday Mar 28th, 2010 at 8:58am

Leave a Comment

Your Name      
Your Email   
Comment

 

"I just wanted to take the time to say I have been looking for an ajax table for months, I probably could have built one by now. Ive seen and Ive tried many different ajax tables and I have to say this ones by far the "BEST" out there! Thank you so much Loud Canvas Media. for all of your hard work. AWESOME! AWESOME! 5 stars."
~jeramy1978

What is a business/commercial website?

A commercial website is one created for a business, for which purpose is generating revenue or cash flow of any type (and that isn't under a non-profit organization). So if you're selling a product, selling advertisement, selling a service, or just marketing a commercial business, your site is commercial. A company website is also commercial even if it doesn't sell anything, as it's purpose is to front a commercial company.
Close