web_master Posted July 11, 2007 Share Posted July 11, 2007 hi, I got a table with users table name: users user_id user_name user_random ... columns <?php if($_GET['random'] == "1") { //Reload from database $query_return=mysql_query("SELECT * FROM `user` ORDER BY `user_id`"); if(!$query_return) { echo mysql_error(); exit; } while($request=mysql_fetch_array($query_return)) { $rand_num = rand(100000000, 999999999); // random nrs } } //eng of GET ?> So, every time when I get random ( $_GET['random'] == "1" ) I must to update in user table the user_random column for every user give a new random nr. Quote Link to comment Share on other sites More sharing options...
clanstyles Posted July 11, 2007 Share Posted July 11, 2007 I don't get what your asking, what do you require? Sorry Quote Link to comment Share on other sites More sharing options...
web_master Posted July 11, 2007 Author Share Posted July 11, 2007 I don't get what your asking, what do you require? Sorry OK, - I got for example 100 users - TABLE users - In users TABLE column RANDOM So, every users can get one new RANDOM number if($_GET['random'] == "1") example: user_id = 1, random = 999999999 user_id = 2, random = 658435448 user_id = 3, random = 865435468 etc on next if($_GET['random'] == "1") user_id = 1, random = 798465484 user_id = 2, random = 654684354 user_id = 3, random = 154754687 etc Quote Link to comment Share on other sites More sharing options...
Carterhost Posted July 11, 2007 Share Posted July 11, 2007 You still haven't asked a question really, though? Quote Link to comment Share on other sites More sharing options...
per1os Posted July 11, 2007 Share Posted July 11, 2007 while($request=mysql_fetch_array($query_return)) { $rand_num = rand(100000000, 999999999); // random nrs mysql_query("UPDATE `user` SET user_random = " . $rand_num . " WHERE user_id = " . $request['user_id'] . " LIMIT 1;"); } Whats one way to do it, inefficient but it works. Quote Link to comment Share on other sites More sharing options...
web_master Posted July 11, 2007 Author Share Posted July 11, 2007 You still haven't asked a question really, though? oh, sorry... this is my bad english... I want to give a random number for every users in "users" table. this is a simpliest explanation... I hope Quote Link to comment Share on other sites More sharing options...
aim25 Posted July 11, 2007 Share Posted July 11, 2007 while($request=mysql_fetch_array($query_return)) { $rand_num = rand(100000000, 999999999); // random nrs mysql_query("UPDATE `user` SET user_random = " . $rand_num . " WHERE user_id = " . $request['user_id'] . " LIMIT 1;"); } Whats one way to do it, inefficient but it works. look at frost's Quote Link to comment Share on other sites More sharing options...
web_master Posted July 11, 2007 Author Share Posted July 11, 2007 while($request=mysql_fetch_array($query_return)) { $rand_num = rand(100000000, 999999999); // random nrs mysql_query("UPDATE `user` SET user_random = " . $rand_num . " WHERE user_id = " . $request['user_id'] . " LIMIT 1;"); } Whats one way to do it, inefficient but it works. THATS IT!!!!!!!!!!! ITS WORK!!!!! Thanks!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.