Adding/modifying users in the MySql Database

Started by Other-Jeff, March 25, 2015, 03:32:34 PM

Previous topic - Next topic

Other-Jeff

Hi,
We need to merge in a bunch of users that ceom to us from an external site, and potentially update exisiting user data as well.

Ive gotten pretty far on my SQL to do this but I have a nagging concern.

I note that you dont use auto-increment in the DB for the id_member field.  This suggests to me that the last allocated id is stored somehwere else but I cannot find it.

Is it in the DB somewhere?  If I create new user records with ids after the last user record SMF created will I screw SMF up?  Or do you query for MAX from the table every time you need a new iD?

Kindred

yes... the last User is in the database (not sure where though... probably smf_settings table)

However... directly adding items to the database is *ALWAYS* a ***BAD*** idea.... as is directly deleting.

There are functions that get run are part of setting up (or deleting) a user record.

Instead, you should write a script that reads the data from something like a CSV and the runs the Register2 function.
http://support.simplemachines.org/function_db/index.php?action=view_function;id=371
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

margarett

Just a correction, SMF *does* use auto increment in id_member. What's stored in smf_settings is the latest member.

Do as Kindred says. There is even a function that returns you the id of the member you just inserted ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Advertisement: