Jump to content


User Creates Multiple Characters

binding user characters mysql

  • Please log in to reply
1 reply to this topic

#1 woj56k



  • New Members
  • Pip
  • 4 posts

Posted 31 December 2012 - 03:29 PM

Hello, I'm not sure if this is in the right area but if it's not please feel free to move it.

I'm in the process of creating a game where a user from the users table will be allowed to create and select characters that are binded to that users profile. Allowing users to have up to two characters that can be selected to "Play As" after login in with the user account. My problem is since while I am not extremely new to php, this approach has me a bit stumped. How could I bind characters created by a userid to that userid?

Is it something simple that I missed and just am over thinking? For example sake, we'll use 'users' table and 'characters' table. Any help or suggestions?

Much appreciated!

#2 Muddy_Funster


    Advanced Member

  • Members
  • PipPipPip
  • 3,164 posts

Posted 31 December 2012 - 03:33 PM

have a userid field in the characters table and use an INNER JOIN to link the tables together.
A simple password hash :

function makePass($word=''){
  $dbSalt = '$2a$07$'.substr(hash('whirlpool',$word),0,22);
  $dbPass = crypt($word, $dbSalt);
 return substr($dbPass,12);


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users