Insert into tables.

Discussion forum for MOD Writers regarding MOD Development.
Locked
kevincon
Registered User
Posts: 27
Joined: Sat Jul 26, 2008 10:28 pm

Insert into tables.

Post by kevincon »

What is the best way to directly insert a user into the tables.

I already have users and I created a "activate user on forum" page, which inserts them into phpbb, However Inserting them directly into the users table and the user_group table didn't work, my script worked fine it all went in well but from the administration control system It says "user not found" they do show up on the member list though.

My question is what tables do I have to insert information on that player into in order for it to work 100%?
User avatar
Erik Frèrejean
Former Team Member
Posts: 9899
Joined: Tue Oct 09, 2007 9:09 am
Location: The Netherlands, 3.0.x Support Forum
Name: Erik Frèrejean
Contact:

Re: Insert into tables.

Post by Erik Frèrejean »

You should always use the phpBB framework for any database mutation. For adding users, use the user_add (mixed $user_row, [string $cp_data = false]) function.
Support Toolkit | Support Request Template | Knowledge Base | phpBB 3.0.x documentation
I don't give support via PM or IM! (all unsolicited pms will be trashed!)
kevincon
Registered User
Posts: 27
Joined: Sat Jul 26, 2008 10:28 pm

Re: Insert into tables.

Post by kevincon »

How could I use that with my code?
Like how could I link my page to PhpBB?
Also can I use that to put the users password on there, Because the users already have passwords.
kevincon
Registered User
Posts: 27
Joined: Sat Jul 26, 2008 10:28 pm

Re: Insert into tables.

Post by kevincon »

I need to insert the following.

Code: Select all

	$user_sess = $_SESSION['username'];

	$user_4_forum = mysql_query("SELECT * FROM users WHERE username='".$user_sess."'") or die ("Error in query".mysql_error());
		if (mysql_num_rows($user_4_forum) > 0) 
			{
				while($row = mysql_fetch_array($user_4_forum)) 
					{
						$steamid = $row["steamid"];
						$rank = $row["rank"];		
						$password = $row["password"];
						$username = $row["username"];
					}
			}
I have a series of codes that if a user rank is a certain number they get inserted into a certain phpbb group, how can I do this as well with your method?
User avatar
Erik Frèrejean
Former Team Member
Posts: 9899
Joined: Tue Oct 09, 2007 9:09 am
Location: The Netherlands, 3.0.x Support Forum
Name: Erik Frèrejean
Contact:

Re: Insert into tables.

Post by Erik Frèrejean »

Moving to MOD writers discussion.
Support Toolkit | Support Request Template | Knowledge Base | phpBB 3.0.x documentation
I don't give support via PM or IM! (all unsolicited pms will be trashed!)
kevincon
Registered User
Posts: 27
Joined: Sat Jul 26, 2008 10:28 pm

Re: Insert into tables.

Post by kevincon »

Thanks
Locked

Return to “[3.0.x] MOD Writers Discussion”