Author Topic: inline editing - refresh issue after mysql delete  (Read 3231 times)

Robert

  • Pro Economy
  • Newbie
  • *
  • Posts: 26
    • View Profile
inline editing - refresh issue after mysql delete
« on: April 09, 2014, 01:21:54 am »
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?

Robert

  • Pro Economy
  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: inline editing - refresh issue after mysql delete
« Reply #1 on: April 09, 2014, 01:41:36 am »
I meant to attach these images to the last submission ..

Robert

  • Pro Economy
  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: inline editing - refresh issue after mysql delete
« Reply #2 on: April 09, 2014, 02:04:45 am »
I figured it out. I was erroneously encoding the wrong data after the DELETE.