Make a script called remove_clone.php. Give it the ability to delete a  
row from your database if it receives a valid ID as a POST parameter.  
Have it return a 200 header if it succeeds, and a 500 if it fails.

For example --- untested:

//include the MyActiveRecord ORM http://github.com/walterdavis/myactiverecord
define('MYACTIVERECORD_CONNECTION_STR', 'mysql://user:p...@localhost/ 
dbName');
require_once('path/to/MyActiveRecord.0.5.php');
class nameOfTable extends MyActiveRecord{}
//nameOfTable should obviously be just that -- the name of your  
database table
//this table must have as its primary key the column 'id',
//and that must be set as the auto-incrementing int(11) column type.
if(isset($_POST['id'])){
        if($record = MyActiveRecord::FindById('nameOfTable',$_POST['id'])){
                $record->destroy();
                print 'deleted';
                exit;
        }else{
                header('HTTP/1.0 500 Server Error',true,500);
                exit;
        }
}

That's about as brief as I can make it. Naturally it is insecure, as  
anyone could craft a POST to it and delete rows from your database.  
But requiring a credential to allow deletes is left as an exercise...

Walter

On Jul 20, 2009, at 11:48 AM, Yan Kovyakh wrote:

>         new Ajax.Request('remove_clone.php',{
>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to