Announcement

Collapse
No announcement yet.

How refresh dashboard only when a new record is inserted on db table

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How refresh dashboard only when a new record is inserted on db table

    Hi all,
    I got a dashboard that monitor all entries and I need to refresh it everytime a barcode reader inserts a new record on the "tubes" mysql table.
    At the moment I do the refresh every 2 seconds and believe it's very ugly to watch !!!
    I need to find the way to refresh the screen only when a new record is inserted but I really don't know where to start.
    I know that jquey and ajax can do something like this but it's really hard for me to find how.
    Anybody there is able to make an easy sample to adapt to my needing ?
    Many thanks

    Video link : https://youtu.be/1-1B-gQCTVc



  • #2
    Hi, I did a blank app that check for new records .
    $sql_results = 'SELECT mytimestamp FROM tubes WHERE mytimestamp >= DATE_SUB(NOW(), INTERVAL 2 SECOND)' ;
    sc_commit_trans();
    sc_select(dataset, $sql_results);
    $timefound = {dataset} ;

    if (false == {dataset})
    {
    echo "ERROR";
    }
    elseif ({dataset}->EOF)
    {
    echo "NO RECORDS";
    }else{
    echo "NEW RECORD";
    }

    but now I don't know how to check it within grid every 1/2 seconds.... and then ... if NEW RECORD do the refresh of grid ....

    Comment

    Working...
    X