Display Username

Thread Solved

Join Date: Jan 2008
Posts: 74
Reputation: Vai is an unknown quantity at this point 
Solved Threads: 5
Vai Vai is offline Offline
Junior Poster in Training

Display Username

 
0
  #1
May 14th, 2008
Here is what I am trying to accomplish: When a user logs in, their username will be displayed... Trouble is I am unsure how to co-relate the username w/ the id... thanks for any and all help....

  1. <?php
  2. require_once('core/db.php');
  3. require_once('core/secure.php');
  4.  
  5. $query = mysql_query("SELECT username FROM admin WHERE id = 1");
  6. $username = mysql_fetch_array($query);
  7. ?>
  8. <?php echo $username[username]; ?>
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 570
Reputation: ryan_vietnow is an unknown quantity at this point 
Solved Threads: 71
ryan_vietnow's Avatar
ryan_vietnow ryan_vietnow is offline Offline
Posting Pro

Re: Display Username

 
1
  #2
May 15th, 2008
  1. <?php
  2. require_once('core/db.php');
  3. require_once('core/secure.php');
  4.  
  5. $query = mysql_query("SELECT username FROM admin WHERE id = 1");
  6. $result=mysql_query($query);
  7. $username=mysql_result($result,0,"username");
  8. ?>
  9. <?php echo $username; ?>

Enjoy!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC