ShoeLace1291 Posted November 1, 2007 Share Posted November 1, 2007 For a while now, I've had a main site(gaming ladders) and a forum. They're on two seperate databases so users would have to register twice to access them. I made a script that loops through database records from the ladders and determines if the ladder user is registered on the forums. If the user is registered on the forums, an account isn't created. If the user is not registered on the forums, an account is created. Now, before I ran the script, the total of the ladders users was 3,717. The total forums users was 1,762. After I ran the script, the total number of forums users is 5,047. I also made a script that calculates the number of forums users that aren't registered on the ladders and the result was 0. So it's obvious that 1,995 of the ladders users weren't registered on the forums since 3,717 - 1,762 = 1,995. So that means 1,995 forum accounts would have to be created so everyone that didn't register on both the ladders and the forums could use both. Shouldn't the total number of forums users be 3,717 if my logic is correct? Quote Link to comment https://forums.phpfreaks.com/topic/75632-does-this-make-sense-to-you/ Share on other sites More sharing options...
harristweed Posted November 1, 2007 Share Posted November 1, 2007 I think your script has added all the 3,717 Ladder users to the Forum Users: Before Update-1,762 Forum users After Update-5,479 Forum Users 3,717+1,762=5,479 Quote Link to comment https://forums.phpfreaks.com/topic/75632-does-this-make-sense-to-you/#findComment-382722 Share on other sites More sharing options...
ShoeLace1291 Posted November 2, 2007 Author Share Posted November 2, 2007 Idk, maybe my logic is incorrect... <?php //Connect to My Gaming Ladder database include('config/config.php'); if($_POST['convert']){ $query = mysql_query("SELECT * FROM users") or die("Error: ".mysql_error()); //How many MGL users are there? $numusers = mysql_num_rows($query); $addedusers = 0; include('community/Settings.php'); $hdlComDataBase = mysql_connect($db_server, $db_user, $db_passwd,true) or die("Could not connect to SMF database server: ".mysql_error()); mysql_select_db($db_name,$hdlComDataBase) or die("Could not select SMF database: ".mysql_error()); if($numusers == 0){ "There are no users registered on My Gaming Ladder."; } else { while($fetch=mysql_fetch_array($query, MYSQL_ASSOC)){ $id=$fetch["id"]; $alias=$fetch["alias"]; $pass=sha1($fetch["pass"]); $email=$fetch["email"]; $icq=$fetch["icq"]; $aim=$fetch["$aim"]; $msn=$fetch["msn"]; $yahoo=$fetch["yahoo"]; $website=$fetch["website"]; $ipaddress=$fetch["ipaddress"]; echo "Converting MGL member <b>$alias</b> to SMF... <br>"; //Connect to SMF database $query2 = mysql_query("SELECT * FROM smf_members WHERE emailAddress = '$email'", $hdlComDataBase) or die("Could not search users: ".mysql_error()); $exists = mysql_num_rows($query2); //If the selected user doesn't exist in the SMF forum database... if($exists==0){ $query3 = "INSERT INTO smf_members (memberName,passwd,emailAddress,websiteUrl,ICQ,AIM,YIM,MSN,memberIP) values ('$alias', '$pass', '$email', '$website', '$icq', '$aim', '$yahoo', '$msn', '$ipaddress')"; //If the query is successfull if(mysql_query($query3,$hdlComDataBase)){ echo "Added MGL member <b>$alias</b> to the SMF forum database.<br>"; $addedusers = $addedusers + 1; //Otherwise... } else { echo "There was an error adding the MGL member <b>$alias</b> to the SMF forum database.<br>"; } } else { echo "The MGL member <b>$alias</b> was not added because he/she is already a member of the SMF forum.<br>"; } } } echo "Database conversion complete. A total of $addedusers My Gaming Ladder users have been successfuly added to SMF."; } else { echo "<form action='".$_SERVER['PHP_SELF']." method='POST'><input type='submit' value='Convert' name='convert'></form>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/75632-does-this-make-sense-to-you/#findComment-383292 Share on other sites More sharing options...
ShoeLace1291 Posted November 2, 2007 Author Share Posted November 2, 2007 I think your script has added all the 3,717 Ladder users to the Forum Users: Before Update-1,762 Forum users After Update-5,479 Forum Users 3,717+1,762=5,479 The number of forum users after the update was 5,041, not 5,479. Quote Link to comment https://forums.phpfreaks.com/topic/75632-does-this-make-sense-to-you/#findComment-383314 Share on other sites More sharing options...
rajivgonsalves Posted November 2, 2007 Share Posted November 2, 2007 So then the update must of gone through fine.. Quote Link to comment https://forums.phpfreaks.com/topic/75632-does-this-make-sense-to-you/#findComment-383320 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.