Retrieve Live Data from wpdb
-
I am trying to run some live data feeds into my page. I am using the global $wpdb variable to access the custom tables and data which works great.
However I have a timer running which re-runs the $wpdb->get_results() and rewrites the results into a div. But after the inital run through the data is not updated as if the $wpdb is not updated.
The function I have is:
<?php global $wpdb; $total = 0; $sales = $wpdb->get_results( "SELECT NET_AMOUNT FROM wp_dailysales"); foreach($sales as $sale) { $total += $sale->NET_AMOUNT; } $total = $total; ?>
If I refresh the page it pulls in the correct data, just not on the timer. Is there a function that I am missing?
Thanks
Simon
Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)
- The topic ‘Retrieve Live Data from wpdb’ is closed to new replies.