Palendrone
Palendrone

Reputation: 363

PHP SESSION for Username

I am trying to make part of my sequence build a chart based on logged in username using the following code, however no matter what I've tried I can't get it to work as the highlighted out line does?

<?php include("auth.php"); ?>
<?php
$con = mysql_connect("***","***","***");

if (!$con) {
  die('Could not connect: ' . mysql_error());
}

mysql_select_db("***", $con);

*/ $query = mysql_query("SELECT * FROM vw2014 WHERE username = 'Palendrone'"); /*

$query = mysql_query("SELECT * FROM vw2014 WHERE username = '".$_SESSION['USERNAME']."'"); */


etc....

Is this correct or am I missing something else?

Upvotes: 0

Views: 36

Answers (1)

alexmngn
alexmngn

Reputation: 9597

Your session doesn't seem started. Without this, you will not be able to grab your session information:

session_start()

Upvotes: 1

Related Questions