user3230425
user3230425

Reputation: 695

Notify changes in the database

Here is a snippet of the script I am using to fetch record in the database.

   var url = '../waitOrders?restaurant_id=1;

    $(document).ready(function() {
            $.ajaxSetup({ cache: false }); 
            setInterval(function() {$("#displayarea").load(url); }, 400);
        });

It works fine but my question is that is there a way to notify me that the database has a new record or changes?

Upvotes: 0

Views: 810

Answers (2)

Mitul Maheshwari
Mitul Maheshwari

Reputation: 2647

1) You can write the triggers for that, which is informed you whenever new entry of data is occure.

OR

2) you can use User Define Functions which helped you when new entry comes to database.

Upvotes: 1

Volterony
Volterony

Reputation: 127

I am not sure what database you are using but if you were using php and mysql:

$query = $db->query("SELECT `articles`.`title`  FROM `articles` LIMIT 6");

while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
echo $row['title'], '<br>';
}

echo '<p>Returned ', $query->rowCount(), ' results</p>';

the $query object is using the rowCount() method to return the number of records added to the databases, so not sure if this answers your question.

Upvotes: 0

Related Questions