如果用户已登录,我想显示用户的全名。如果没有,则应显示文本“登录”。
这是我到目前为止所拥有的:
session_start();
$session = $_SESSION['username'];
include "config.php";
$sql = mysql_query("SELECT * from user");
while($d=mysql_fetch_array($sql))
{
if($d['status']=='online' and $_SESSION['username'] == $d['username'])
{
$full_names = $d['full_name'];
echo $full_names;
}
else
{
echo "Login";
}
}
有任何想法吗?