Jump to content

Login


IT-Guy

Recommended Posts

Hey,

 

I have my login, and each user has their own username and password. Once they login, I want it to say, welcome "$firstname" "$lastname"

(Which will be there name). All I really want is their First Name and Last Name to display on the page

ie (Hello, Joe Smith)... So is this how I would do it?

 

<?php
$con = mysql_connect("****","****","****") or die('Could not connect: ' . mysql_error());
mysql_select_db("login", $con);

$result = mysql_query("SELECT * FROM users");
while($row = mysql_fetch_assoc($result)){
  echo "<b>Hello,</b> {$row['firstname']} {$row['lastname']}<br>";

 

Link to comment
https://forums.phpfreaks.com/topic/91540-login/
Share on other sites

Nope the error Im getting is

 

Parse error: parse error, unexpected $end on line 80

Thats why I was wondering if I was doing it right :(

$con = mysql_connect("****","***","***") or die('Could not connect: ' . mysql_error());
mysql_select_db("login", $con);

$result = mysql_query("SELECT * FROM users");
while($row = mysql_fetch_assoc($result)){
  echo "<b>Hello,</b> {$row['firstname']} {$row['lastname']}<br>";
?>

 

Link to comment
https://forums.phpfreaks.com/topic/91540-login/#findComment-468921
Share on other sites

That should work, I think, test it and let me know.

 

<?php
$con = mysql_connect("****","****","****") or die('Could not connect: ' . mysql_error());
mysql_select_db("login", $con);

$result = mysql_query("SELECT * FROM users");
while($row = mysql_fetch_assoc($result)){
  echo "<b>Hello,</b> {$row['firstname']} {$row['lastname']}<br>";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/91540-login/#findComment-468926
Share on other sites

haha well now the parse error is gone, this is the problem now. Its printing "Hello, $first, $last" (ie: Hello Joe Smith) for every record in the database. I only want it to show the name of the person that corresponds with their login ID. So wouldn't that be a session problem on my login script? Do I need to add a start_session() to the login script? Or is it something that can be fixed just by using my script above?

Link to comment
https://forums.phpfreaks.com/topic/91540-login/#findComment-468930
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.