Msg#: 4413205 posted 7:24 pm on Feb 1, 2012 (gmt 0)
I have a PHP login script/ login for my website that stores name and password and email in an SQL database called "members". After the members login I have them directed to a member profile page. I would like them to add a description about themselves, gender, location and stuff like that to this member profile page.
My question: Can I have them add this to a different database other than the "members" one I have for the login. Also if I do this how can I pull the name and password they already entered and echo it on the profile page with the info they enter from the other "lets say profile" database I make?
Msg#: 4413205 posted 8:03 pm on Feb 2, 2012 (gmt 0)
Hello roclimb, is there a special need for another database? or do you mean another table which is within the same database? if so you can have another table that has a relationship with the members table called profile table. Do you know much about relational databases? depending on how many rows a member needs in the profile table you may have a 1 to 1 relationship or 1 to many relationship. If it is a 1 to 1 relationship then keep all the data in the members table but keep the fields optional so that it can be updated afterwards. if that makes sense.
Msg#: 4413205 posted 12:23 am on Feb 4, 2012 (gmt 0)
thanks for the reply. I think I understand what you are saying. Basically I have a login that requires username and password and email. After logged in I have things redirected to an "optional" member profile page. If a member wants they can add a description about themselves, a photo, and part of the us they are from. I guess I will just add the latter three into new rows in the member table? and leave the latter null so they can choose to add those fields or not? Thanks again for any help you can give
Msg#: 4413205 posted 3:49 am on Feb 4, 2012 (gmt 0)
hey roclimb. I think abushahin is saying create another table called "profile" in the members database to store the additional member data.
I.E. <?php $memberaboutme = $_POST['memberaboutme']; $memberlocation = $_POST['memberlocation']; $memberid = int($_REQUEST['memberid']);//this will be the ID of the data row in the member table assuming you use one.
//Insert it into the member database, profile table //The first VALUE('', is where you would have an id auto set using "auto increment" mysql_query("INSERT INTO profile VALUES('', '$memberid', '$memberaboutme', '$memberlocation')")or die(mysql_error());
Msg#: 4413205 posted 2:12 pm on Feb 4, 2012 (gmt 0)
If the members are already registered with a PW and a UN I won't use auto increment for the new table, but an insert including the last entered ID so there is an easy connectivity in between tables. now if there are just few fields in the membership table why complicating things add a few new fields in the existing table.