condy — 2012-02-01T11:19:20-05:00 — #1
Hi, I want to display the 'name' field from mysql database 'user' on my webpage once the user logs in.
There could be 2 people with the same login details but with different names so I would like it to display both names in 2 columns if possible.
so far I have:
$sql = "SELECT name users WHERE username = '" . $_SESSION['username'] . "'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
echo "Hello, " . $row['name'] . ").";
fizixrichard — 2012-02-01T11:42:07-05:00 — #2
"There could be 2 people with the same login details but with different names"
Do you mean there could be two people with the same username or two people with different usernames but the same "name" (name being display name, real name or whatever).???
condy — 2012-02-01T11:46:06-05:00 — #3
thanks for your reply. Yes there could be 2 people with the same login details (username and password) but they have different names.
Coming to think of it. It would be easier if I put the same login details but with name1, name2 in the mysql database fields wouldnt it?
If so, back to my orginal question, how can I display these names on my webpage from the mysql. (name1, name2) already entered into mysql just a matter of retrieving them.
fizixrichard — 2012-02-01T11:48:31-05:00 — #4
I'm not sure how to answer this, sorry if it sounds rude but...
Why on earth are you allowing 2 people to have the same username?
Your usernames should be unique, so if someone attempts to register with a username that is already in use it will say no.
Anyway, your basically saying that someone has a name (forename surname type affair)? And you want the forename and surname (name1, name2) to be displayed on the page?
condy — 2012-02-01T13:22:24-05:00 — #5
hi yes thats why I am doing a name1, name2, name3 approach instead.
that is exactly what i want