PDA

View Full Version : Delete function with php/mysql backend problem



wattee
30 Dec 2009, 5:35 AM
Hi,
i've encountered a problem following a tutorial http://defafe.com/tutorial-extjs-edit-and-delete-file/

Problem: When i hit the delete button after selecting something from grid windows flips me this:
Apache HTTP Server has encountered a problem and needs to close. We are sorry for the inconvenience.
Twice.

Afterwards it stops the response and gives me an option to "LOAD RESPONSE".
Thing is it actually deletes selected items from database but it's really inconvinient, so how could i go about and fix this?

Del function


function del(btn){
if(btn == 'yes'){
var m = SimpleListingEditorGrid.getSelectionModel().getSelections();
SimpleDataStore.load({params:{del:m[0].get("id"),start:0,limit:6}});
}
}

Del button


{
//buttton delete
text:'Delete',
iconCls:'delete',//create icon
handler: function()
{
var m = SimpleListingEditorGrid.getSelectionModel().getSelections();
if(m.length > 0){
Ext.MessageBox.confirm('Message', 'are you sure to delete this file?' , del);
}
else{
Ext.MessageBox.alert('Message', 'please... Choose one of file...!');
}
}

}


Php


else if(isset($_POST["del"])){
$sql = "delete from simpleform where id ='".$_POST["del"]."'";
mysql_query($sql) or die(mysql_error());
mysql_close();
}



And another question about the del function


var m = SimpleListingEditorGrid.getSelectionModel().getSelections();
SimpleDataStore.load({params:{del:m[0].get("id"),start:0,limit:6}});

this is for multiple selections, how would i change it if i had a singleselect grid?

wattee
31 Dec 2009, 5:23 AM
Any suggestions, directions?