The delete button in the "inline editing" example appears to be working fine and I have inserted code in the PHP file to DELETE the record from the DB. This is working as well. HOWEVER, After the execution of the DELETE code on the DB, the grid does not refresh. It show now rows at all even though the commit AND refreshandview calls are being execute in the JS.
I am just getting an empty data object back. Here is the code modifications I made in the delete:
else if( isset($_GET["pq_delete"]))
{
session_start();
$SongID = $_GET["SongID"];
$songs = json_decode($_SESSION["Songs"], true);
foreach($songs as $i => $song){
if($song["songID"] == $SongID){
unset($songs[$i]);
//delete code here???
$sql = "DELETE FROM songs WHERE songID = $SongID";
$dsn = 'mysql:host='.'localhost'.';dbname='.'Setlist_Manager_DB';
$options = array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
);
$dbh = new PDO($dsn, 'root', '', $options);
$stmt = $dbh->prepare($sql);
$stmt->execute();
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
}
}
$_SESSION["Songs"]= json_encode($rows);
echo "{\"result\": \"success\"}";
}
Suggestions?