Jump to content

Whats the best way to update mysql table in a while or a loop


Mancent

Recommended Posts

This way seems not good.

 

<?php
$username ="MANCENT";
$user_input_x = _xmouse.movement ;//FLASH
$user_input_y = _ymouse.movement ;//FLASH

while(true)
{
$updatepos = mysql_query("UPDATE users_float SET user_input_x = '$user_input_x' , user_input_y = '$user_input_y' WHERE username = '$username'");
}

This way works but whats a better way?

?>

Could you explain what the code is doing? Maybe there is a better way because it looks like flash is sending x/y mouse co-ords to a script which is then updating the database. How often does this happen? Every iteration?

sure..

 

We are in flash application and as you the user move your mouse on a x y axis you are updating using php server side script to insert as a update where user id x mouse movement and user y mouse movement

 

so if user "A" is in some user zone as user"B" show both or many MMORPG simple script like..

 

Its a Movement script updating mysql table users_float table user_id, user_x, user_y

and then if the users are in the same zone the users see ne and other.

 

its a simple idea. and I have it working but its choppy so I'm looking to see whats the best way to do it using PHP if PHP can do it. I might need to add c++ to the project.

I do not know if this is a bad idea becasue it would always be updating none stop when the users is login..

 

See the idea is when a user clicks on a friends picture that user sends a message to the friend asking if they can come in. then the friend says yes or no and if yes they are both at that users zone where they both can chat private to one and other or have a party in thier personal zone space. and while the user is in that zone with that user they both see each others movement...

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.