im fairly new to php and ive been searching the internet for help on this and have tried many different ways and yet i cant get it to work the way im wanting it, so i figure theres some basic principle ive missed.
i took my log in code from a site(that gave permission to take it) and managed to change it to let the user select a “profession” (which i spelled wrong then so i just kept it wrong) when registering. This works correctly but now i want to get that data and use it, just that one piece of data.
this is the piece of code im useing…
/* Username and password correct, register session variables */
$_POST[‘user’] = stripslashes($_POST[‘user’]);
$_SESSION[‘username’] = $_POST[‘user’];
$_SESSION[‘password’] = $md5pass;
mysql_connect("my_db_host","db_user","db_pass");
mysql_select_db("db_name");
$queryprof = mysql_query("SELECT proffesion FROM users WHERE username = "[u]The Name They Typed In When Loging In[/u]"");
while($row = mysql_fetch_array($queryprof))
{ $prof = $row['proffesion'];
$prof = [u]$_SESSION['proffesion'];[/u]
}
when connecting to the DB i have changed the names and such to be correct.
after this, to test to see if it’s worked im printing out the result in a separate function that shows when the user has logged in.
i THINK my problem lies in my variable choices, in the two underlined sections ive tried many different variables, none of which printed out.
or maybe i dont understand $_SESSION variables, or tables in databases weren’t meant to be used this way, or im missing some step to have the result print out in teh separate function.
i hope i provided the correct section/amount of code to help me out, thank yall
ill keep looking for answers.