Jump to content

Logged in users - Session!!!!


budimir

Recommended Posts

Write a SQL query that retrieves all of the $_SESSION['username'] in the DB.

 

if you set the 'username' = $_SESSION['username']; when you input the data, then when you retrieve 'username' the values should output correctly

 

<?php
$dbname = 'databasehere';
mysql_select_db($dbname);

$query  = "SELECT `username` FROM `users` LIMIT 0, 5";
$result = mysql_query($query) or die('Error, query failed.');

while($row = mysql_fetch_array($result))
{
$username = $row['username'];
echo "These are the listed users:" . $username 
. ", "; 
}
?>

 

Quick little bit of code I wrote for you, mess with it. Hope it helps.

Archived

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

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