Jump to content

list by session username


Gatsu

Recommended Posts

hi, I have a login site that wants to list something with the username.I use this

$result = mysql_query("SELECT * FROM orders WHERE login='".$_SESSION['login']."' ORDER BY id DESC");while($row = mysql_fetch_array($result))  {  echo "<table border='2' cellpadding='0'><tr>";  echo "<th>id</th>";  echo "<th>user</th>";  echo "<th>Order Status</th></tr>";  echo "<tr><td>" . $row['id'] . "</td>";  echo "<td>" . $row['login'] . "</td>";  echo "<td>" . $row['os'] . "</td></tr></table>";  }  echo "I'm working on this atm... <br \>";

the '".$_SESSION['login']."' works when I am adding the username in the user row in the db but how do I use this to list the logged in user only?

Link to comment
Share on other sites

its not working so maybe you can look at all code if its not too much to ask :$

<?phpsession_start();?><style type="text/css"><!--body,td,th {	color: #FFFF00;}body {	background-image: url();	background-color: #21474B;}--></style><?php$con = mysql_connect("localhost","********","******");if (!$con)  {  die('Could not connect: ' . mysql_error());  }mysql_select_db("******", $con);$result = mysql_query("SELECT * FROM orders WHERE login='".$_SESSION['login']."' ORDER BY id DESC");while($row = mysql_fetch_array($result))  {  echo "<table border='2' cellpadding='0'><tr>";  echo "<th>id</th>";  echo "<th>user</th>";  echo "<th>Vocation</th>";  echo "<th>Current Level</th>";  echo "<th>Desired Level</th>";  echo "<th>World Type</th>";  echo "<th>Account Status</th>";  echo "<th>Skills</th>";  echo "<th>Mag lvl</th>";  echo "<th>Equipment</th>";  echo "<th>Leveler</th>";  echo "<th>Order Status</th></tr>";  echo "<tr><td>" . $row['id'] . "</td>";  echo "<td>" . $row['login'] . "</td>";  echo "<td>" . $row['vocation'] . "</td>";  echo "<td>" . $row['cl'] . "</td>";  echo "<td>" . $row['dl'] . "</td>";  echo "<td>" . $row['wt'] . "</td>";  echo "<td>" . $row['prem'] . "</td>";  echo "<td>" . $row['skills'] . "</td>";  echo "<td>" . $row['mag'] . "</td>";  echo "<td>" . $row['eq'] . "</td>";  echo "<td>" . $row['leveler'] . "</td>";  echo "<td>" . $row['os'] . "</td></tr></table>";  }  echo "I'm working on this atm... <br \>";mysql_close($con);?>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...