View Single Post
  #2 (permalink)  
Old 10-30-09, 10:00 PM
Jcbones Jcbones is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: North Carolina, USA
Posts: 516
Thanks: 5
Thanked 47 Times in 44 Posts
What is the user ID, is it the auto increment column?

PHP Code:

<?php
session_start
();
include_once(
"dbc.php");
   if(isset(
$_SESSION['userSession']) && !empty($_SESSION['userSession']))
 
        include_once(
"dbc.php");
$result mysql_query("SELECT name FROM users WHERE username ='".$_SESSION['userId'] . "'"); 
$row mysql_fetch_row($result);
$username $row[0];
?>
Change the query (name) to reflect exactly what column your looking for. I'm assuming 'userid' is the integer of the row.

PS. you could always just save the username into a $_SESSION variable.
Reply With Quote
The Following User Says Thank You to Jcbones For This Useful Post:
sac0o01 (10-31-09)