Jump to content

Same Query every second, not once.


nightkarnation

Recommended Posts

Hey Guys,

I need some help and/or suggestions on how to apply the following:

 

Simple Example Code:

 

$result = mysql_query("SELECT Last_B_Time FROM MAIN WHERE Id = '$id'"); 
    $cant = 0; 
    while($row=mysql_fetch_array($result))
{ 		
	echo "Last_B_Time$cant=$row[Last_B_Time]&"; 
        $cant++;
    } 

 

I want this simple code/query and echo to be executed every second (not once), directly when test.php is opened.

What is the best way to do this? Using a timer?

 

Thanks a lot in advance!

 

 

Link to comment
https://forums.phpfreaks.com/topic/241738-same-query-every-second-not-once/
Share on other sites

I have a dedicated server.

 

I need to do this, to retrieve the server date every second.

I know this would be easily fixed performing a calculation with just retrieving once the server date but I also need to know each second if there has been a new bid for any auction (its an auction site)

 

Any suggestions?

Thanks a lot!

Well, the php script will only run (i think) with action from an outside source.

 

If you are wanting to send once a second a bit of data from the client to the server and back to the client... AJAX?

 

But then what if the connection slows at any point and the data transfer is 3 seconds? That would screw your script up.

 

What are the special functions? Do they need to be done by the server? Would a js function suffice?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.