Jump to content

printing $_SESSION variable


Lynas555

Recommended Posts

okay so I'm having problems printing things from an SQL table.

 

i have this:

 

<?php 
include("dbconfig.php");

$firstname_query = mysql_query("SELECT FirstName FROM user WHERE UserID='$_SESSION[userID]'") ;
$firstname_result = mysql_fetch_array($firstname_query); 

$surname_query = mysql_query("SELECT Surname FROM user WHERE UserID='$_SESSION[userID]'");
$surname_result = mysql_fetch_array($surname_query); 

$tutorgroup_query = mysql_query("SELECT TutorGroup FROM user WHEREUserID='$_SESSION[userID]'");
$tutorgroup_result = mysql_fetch_array($tutorgroup_query); 

$_SESSION['FirstName'] = $firstname_result['FirstName']; 
$_SESSION['Surname'] = $surname_result['Surname']; 
$_SESSION['TutorGroup'] = $tutorgroup_result['TutorGroup']; 

?>

 

and then elsewhere i have:

<p class="style3">Name: </p> <?php print($_SESSION['FirstName'] . $_SESSION['Surname']); ?>

<p class="style3">Tutor group: </p> <?php print($_SESSION['TutorGroup']); ?>

 

It prints the surname and tutorgroup just fine, but it wont print the firstname from the table. Can anyone see something that i have done wrong?thanks.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.