haibec Posted September 4, 2006 Share Posted September 4, 2006 Hi...!I have table User includes fields : username, password,name. I want insert concurent 5000 user have username from user1 to user5000 and password is values random . Please help me .! Link to comment Share on other sites More sharing options...
tutsamewasa Posted September 4, 2006 Share Posted September 4, 2006 Hi,Write a dynamic query in a loop that Itrates 1 to 5000.append the loop index to the query like 'user' + i, user random function to generate the randon password.If you need exact code let me know.Hope this helps.Good LuckHemendra Singh ShaktawatMindfire Solutionswww.mindfiresolutions.com Link to comment Share on other sites More sharing options...
haibec Posted September 4, 2006 Author Share Posted September 4, 2006 Hi,Write a dynamic query in a loop that Itrates 1 to 5000.append the loop index to the query like 'user' + i, user random function to generate the randon password.If you need exact code let me know.Hope this helps.Good LuckHemendra Singh ShaktawatMindfire Solutionswww.mindfiresolutions.comI need exact code! help me Link to comment Share on other sites More sharing options...
Guest C + PHP Posted September 8, 2006 Share Posted September 8, 2006 <HTML><HEAD><TITLE>This is a tool adding 5000 users to an MySQL db</TITLE></HEAD><BODY><FONT FACE="Courier New" SIZE="3"><?php // code to connect to MySQL server (resulting connection to server: $con)// code to select a DB$i = 1;$p = 1234567;while ($i <= 5000) { $p = rand(4194304, 2147483647); $sql = "INSERT INTO user_table (uid, username, password) VALUES ('$i','user$i','$p')"; if (!mysql_query($sql, $con)) { die ('Error: ' . mysql_error()); } echo "1 (more) record added: user$i"; $i++;}// code to close connection?></FONT></BODY></HTML> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now