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
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!

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.