ajaxCRUD.com

» a PHP API to create / read / update / delete from a database table using AJAX

Quick Links:

Quick Examples:



www.allthewebsites.org

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
      NEW Value   
   555 NEW Value 978
6       454
      This is another Value   
ffff fffffff This is another Value ffffff99
1234 trssd NEW Value dffggg
a a NEW Value a
      My Awesome Value   

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

"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

Leave a Comment

Your Name      
Your Email   
Comment