Mancent Posted December 19, 2010 Share Posted December 19, 2010 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? ?> Link to comment https://forums.phpfreaks.com/topic/222112-whats-the-best-way-to-update-mysql-table-in-a-while-or-a-loop/ Share on other sites More sharing options...
Anti-Moronic Posted December 19, 2010 Share Posted December 19, 2010 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? Link to comment https://forums.phpfreaks.com/topic/222112-whats-the-best-way-to-update-mysql-table-in-a-while-or-a-loop/#findComment-1149160 Share on other sites More sharing options...
Mancent Posted December 19, 2010 Author Share Posted December 19, 2010 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... Link to comment https://forums.phpfreaks.com/topic/222112-whats-the-best-way-to-update-mysql-table-in-a-while-or-a-loop/#findComment-1149166 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.