I will quote my previous posts from other sites: >.> I hope someone here can indeed help me with this - a script to do this. I know it's somewhat complex but I could give you little green rep things that will probably be gray instead of green because I don't have the age on my account I would otherwise have had I been told about this site ages ago.
I found your post quite difficult to follow but as far as I can tell your problem is that you have a whole number of entries deleted from the table phpbb_users and you want to go through and restore them. You don't want to overwrite the users that still exist though. Is this right? I don't want to post something detailed up until I know as i've been using the MDB2 PEAR package to handle database interaction for so long that I've forgotten how the native functions work and that's probably what you want.
You got it down. That is exactly what I am trying to do - except there are more deleted users than existing users. I need to replace the deleted users with a dummy user, and I would like each dummy user to have the id number it corresponds with in the name. Like if User ID 444 is missing the script will make dummy444, and thus all the posts lost by that user through the incorrect deletion performed by the previous owner will be restored.
Then lets see what we can do . . . $x = 1; while($x < 3000) { $sql_query = "SELECT user_id FROM phpbb_users WHERE user_id = '$x'"; $result = mysql_query($sql_query); if(mysql_num_rows($result) != 1) { $sql_insert = "INSERT INTO `phpbb_users` (`user_id`, `user_active`, `username`, `user_password`) VALUES ('$x', '0', 'Dummy{$x}', 'X')"; $insert_result = mysql_query($sql_insert); } $x++; } PHP: It's not particularly elegant and is more resource intensive than it should be but it should get the job done and as you only need to run it once performance isn't a major concern. Remember that my memory of the native PHP functions is rusty so backup your data before giving it a try. I would also suggest you use something other than 'Dummy', as it isn't very flattering. Perhaps archive instead.