Page 1 of 1

Displaying dynamic data from a table if logged in php/mysql

Posted: Sun Mar 06, 2011 7:50 am
by meisenheimere
Essentially, i have a database setup with several tables that store various info. I have a table named "members" for member information (username/password/contact details etc.), and a table named "events" for dynamic global variables. What i mean by that is the table has variables that are updated and displayed collectively by the users that are currently logged in. The variables (all integers) are constantly changing (basically on a second to second basis) based on user input and need to be displayed and updated in the "events" table if lets say, the user presses a button after having logged in. So to sum it up, i'm trying to figure out a way to have relatively instantaneous dynamic data displayed on the press of a button. If this is more of a mysql question, i apologize, but i just wasnt sure exactly where to ask. Any comments or advice will be greatly appreciated.

The goal i'm trying to achieve is something like this:

if(user=logged_in){
if(int<500){
onClick(connect to database and display int from table "events");
int++;
update int in table "events";
}
}

I know onClick doesn't work in php, but i have a system of iframes that just load php scripts to simulate onClick, so disregard that. I was thinking if there was a way to just have the int displayed inherently, only hidden, and just have it show and update onClick, that would probably also work. The quicker, the better. Again, any insight into this situation will be greatly appreciated :)

EDIT: I'm using session variables to track the login and other statistics. So if there is maybe a way to constantly update session variable from data in a database table, that would be okay too.

Re: Displaying dynamic data from a table if logged in php/my

Posted: Sun Mar 06, 2011 11:33 am
by litebearer
perhaps using ajax to 'refresh' the displayed data every x seconds - similar to a stock-ticker-tape