MyBB Community Forums

Full Version: Insert 200 new users to database
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
G33k - you are a star. I will ask my friend to get me the excel file (I will first check she has it complete) - and then forward it to you as CSV.

Thank you.
Hi all,

even if this post is a bit old, I'm facing some similar problem with no solution found yet ...

Desperately trying to "synchronize" entries from one system with the mybb systems via php code, but always getting username=1 and password=0 ... What am I doing wrong (values $_MAIL, $_PSEUDO and $_PASSWORT does contain values)? Using mybb version 1.6.1

Code snippet:
$res2=mysql_query("select * from mybb_users where email like '" .$_MAIL ."'");
$num2=mysql_num_rows($res2);
if ($num2>0) {
//update ...
$sql = "UPDATE mybb_users SET
username='".$_PSEUDO."',
email='".$_MAIL."', avatar='images/avatars/vet.gif?dateline=1339083844',
password='".$_PASSWORT."' WHERE email like'" .$_MAIL ."'";
mysql_query($sql) OR die(mysql_error());
}
else {
//add ...
$sql = "INSERT INTO mybb_users (username, email, avatar, password) VALUES ( username='".$_PSEUDO."', email='".$_MAIL ."', avatar='images/avatars/vet.gif?dateline=1339083844',
password='".$_PASSWORT ."')";
mysql_query($sql) OR die(mysql_error());
}

Thanks so much in advance for any suggestion

Regards,
Pascal
Hi Pascal - this was originally my request and g33k did help me, but I was populating an empty user table from an EXcel file, so I am not sure if that is what you want, it seems more that you are trying to update fields, or insert a user.

I was trying something else, not related, and I have been looking at the http://mods.mybb.com/view/mydevel-generate mod. In that mod users are randomly generated - maybe it is possible to adapt his code for the insert, and even the update.
Hi Leefish,

thanks a lot for your quick reply and the link to the mod!

You are right, I'm trying to add users or edit existing users in the table mybb_users: I thought that there might be somebody around here able to help straight in php about this specific issue.

However, I'll analyse the code of the mod, but actually I'm afraid about the "overkill" of work to understand and adjust: maybe somebody else can help in the meantime?

Thx a lot and regards,
Pascal
Pages: 1 2