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

   by loud canvas media

AjaxCRUD Class Documentation / Reference Material

<< Reference overview
<< Home


adds a button to every row and sends the id (pk) of that item to any url
void addButtontoRow( String buttonValue, String URL, [ String $attach_params ], [ String $javascript_tags ], [ String $window_to_open ] )
Use this function to pass the primary key to another page (url) to do some other process. This function is very useful when your database has many-to-many relationships and you need to "attach" multiple items to an item.

By default the GET parameter for the primary key is passed to the page with the id being the primary key value. However, you can use the word "ALL" as an optional third parameter to have ALL fields and their values passed!


Type function
Returns void
Default no button


Value for the button
a web script (eg a php, .asp, .jsp file)
attach_param (optional)
the field you want to pass to the URL. Can be "all" which means all fields
javascript_tags (optional)
any javascript you want added to the button
window_to_open (optional)
open this page in a "new" window (default is "same")


$tblDemo->addButtonToRow("View", "myOwnDisplayPage.php");
//this second example will pass ALL fields to the update form page
$tblDemo->addButtonToRow("Edit", "myOwnUpdateForm.php", "all");
//this third example will pass only the "myDBField" variable (and value) to the update page
$tblDemo->addButtonToRow("Edit", "myOwnUpdateForm.php", "myDBField");
//this fourth example will pass in the name of a user-defined JavaScript function which will allow the page to open up in specific window
$mytable->addButtonToRow("View", "", "", "myJavascriptFunctionToOpenInNewWindow");
<script> function myJavascriptFunctionToOpenInNewWindow(id){ alert('opening new window'); window.open('test.php?courseid=' + id'); } </script>

See also

New, Edit


"Thanks a lot for all AjaxCRUD project. It makes my day... works like a charm!"

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.