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. Link to comment https://forums.phpfreaks.com/topic/59478-solved-random-numbers-to-users-in-dbase/ 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 Link to comment https://forums.phpfreaks.com/topic/59478-solved-random-numbers-to-users-in-dbase/#findComment-295569 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 Link to comment https://forums.phpfreaks.com/topic/59478-solved-random-numbers-to-users-in-dbase/#findComment-295572 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? Link to comment https://forums.phpfreaks.com/topic/59478-solved-random-numbers-to-users-in-dbase/#findComment-295574 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. Link to comment https://forums.phpfreaks.com/topic/59478-solved-random-numbers-to-users-in-dbase/#findComment-295575 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 Link to comment https://forums.phpfreaks.com/topic/59478-solved-random-numbers-to-users-in-dbase/#findComment-295576 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 Link to comment https://forums.phpfreaks.com/topic/59478-solved-random-numbers-to-users-in-dbase/#findComment-295577 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!!! Link to comment https://forums.phpfreaks.com/topic/59478-solved-random-numbers-to-users-in-dbase/#findComment-295579 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.