very insecure example.
URL input => php using MYSQL backend => output CSV format
All you do is send a delete, insert, update URL command like and other simeple web aplication but all you need to do is update your grid after every change with fresh info from the DB.
data2.php
<?php
function db_connect() {
$database_name = 'xxxxxxx';
$database_username = 'xxxxxxx';
$database_password = 'xxxxxxx';
$result = mysql_pconnect('localhost',$database_username, $database_password);
if (!$result) return false;
if (!mysql_select_db($database_name)) return false;
return $result;
}
$conn = db_connect();
$query;
$type = isset($_REQUEST['pr']) ? $_REQUEST['pr'] : '';
$id = isset($_REQUEST['id']) ? $_REQUEST['id'] : '';
$fn = isset($_REQUEST['fn']) ? $_REQUEST['fn'] : '';
$ln = isset($_REQUEST['ln']) ? $_REQUEST['ln'] : '';
$ad = isset($_REQUEST['ad']) ? $_REQUEST['ad'] : '';
$ct = isset($_REQUEST['ct']) ? $_REQUEST['ct'] : '';
$st = isset($_REQUEST['st']) ? $_REQUEST['st'] : '';
$zp = isset($_REQUEST['zp']) ? $_REQUEST['zp'] : '';
$cn = isset($_REQUEST['cn']) ? $_REQUEST['cn'] : '';
$ph = isset($_REQUEST['ph']) ? $_REQUEST['ph'] : '';
if ( $type == "Update") {
$query = "UPDATE GUEST SET "
. "F_NAME = '" . $fn
. "', L_NAME = '" . $ln
. "', STR_ADDRESS = '" . $ad
. "', CITY = '" . $ct
. "', STATE = '" . $st
. "', ZIP = " . $zp
. ", COUNTRY = '" . $cn
. "', PHONE_Num = '" . $ph
. "' WHERE GUEST_ID = " . $id;
}
if ( $type == "Add") {
$query = "INSERT INTO GUEST "
. "(F_NAME, L_NAME, STR_ADDRESS, "
. "CITY, STATE, ZIP, COUNTRY, PHONE_Num)"
. " VALUES ("
. "'" . $fn . "', '" . $ln
. "', '" . $ad . "', '" . $ct
. "', '" . $st . "', " . $zp
. ", '" . $cn . "', '" . $ph . "')";
}
if ( $type == "Delete") {
$query = "DELETE FROM GUEST WHERE GUEST_ID = " . $id;
}
echo $query;
if ($conn && $query != "") {
$result = mysql_query($query,$conn);
}
?>
SAMPLE ACTIVE WIDGET BUTTON
DELETE RECORD
bobj3.onClick = function(text){
if(live_button){
var Da = new Date();
var tmp = "/data2.php?pr=Delete" +
"&id=" + input1.getControlText() +
"&m=" + Da.getTime();
output.setControlText(tmp);
sendRequest(tmp);
clear_form();
pausecomp(1250);
load("data.php?t=guest");
}
};
when the delete button is clicked it will send a delete command to the server to with the unique record ID. It will them clear the record form (something not shown in this example) wait a few second then update the grid with new data.
most of the above funtions are retrive from several past forum postfrom other contributurs all pulled togeather to deal with one problem or another.
Hope this helps you.