I have been trying to get delete.php to work from http://sanderkorvemaker.nl/test/flexigrid/ again , but somehow it is not deleting from my table, even when i have enabled the sql runSQL to do the delete action.
I read someone has the same problem at this post. http://ellislab.com/forums/viewthread/75326/P270/
post#280, that all they did is remove the trailing comma (,) but where is the trailing comma (,)?
<?
error_reporting(0);
function runSQL($rsql) {
$hostname = "localhost";
$username = "root";
$password = "";
$dbname = "tutorial";
$connect = mysql_connect($hostname,$username,$password) or die ("Error: could not connect to database");
$db = mysql_select_db($dbname);
$result = mysql_query($rsql) or die ('test');
return $result;
mysql_close($connect);
}
$items = rtrim($_POST['items'],",");
$sql = "DELETE FROM 'service_table' WHERE 'id' IN ($items)";
$total = count(explode(",",$items));
$result = runSQL($sql);
$total = mysql_affected_rows();
/// Line 18/19 commented for demo purposes. The MySQL query is not executed in this case. When line 18 and 19 are uncommented, the MySQL query will be executed.
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
header("Cache-Control: no-cache, must-revalidate" );
header("Pragma: no-cache" );
header("Content-type: text/x-json");
$json = "";
$json .= "{\n";
$json .= "query: '".$sql."',\n";
$json .= "total: $total,\n";
$json .= "}\n";
echo $json;
?>
