使用登录的PHP连接

使用登录的PHP连接,php,mysql,database,Php,Mysql,Database,我有以下问题, 当我连接数据库中的用户时,他不记得登录名。 实际上,我想在我的网页中显示连接的成员的名称 我的代码: config.php <?php $connect = mysql_connect('localhost','root','aragorn11') or die ("erreur de connexion"); mysql_select_db('biblio',$connect) or die ("erreur de connexion base"); ?> s

我有以下问题,

当我连接数据库中的用户时,他不记得登录名。 实际上,我想在我的网页中显示连接的成员的名称

我的代码:

config.php

<?php
$connect = mysql_connect('localhost','root','aragorn11') or die ("erreur de connexion");
mysql_select_db('biblio',$connect) or die ("erreur de connexion base");
?>

session.php

<?php
session_start();
if (isset($_SESSION["login"])){
    $connected=1;
    $login=$_SESSION["login"];
}
?>  

和member.php

<?php 
include ("config.php"); 
include ("session.php"); 
?>
<!DOCTYPE html>
<html>
   <head>
     <meta charset="utf-8" />
     <title>Adherents_Connectés</title>
     <link rel="stylesheet" type="text/css" href="accueil.css" />
   </head>
   <body>   

<?php
  echo "<h4>Welcome : $login</h4>\n";
?>

    <h4> <a href = "index.html"> Déconnexion </a> <br/> </h4>


    <p> Liste des actions possibles pour un adherent de la bibliothèque est :
    <ul>
    <a href = "liste_dispo_adherents.php" > Consulter la liste des livres disponibles </a> 
    </ul>
    <ul>
    <a href = "emprunt.php" > Emprunter un livre </a> 
    </ul>
    </p>
</body>
</html>

信徒们

列出可能采取的行动,以支持图书馆:


您现在向我们展示的代码从未为会话[“登录”]分配值,因此它从未设置,因此,
$login
将永远不会有值


还有,哦,.

为什么不应该使用mysql_*函数:阅读此=>@Bulk发生了更多奇怪的事情,虽然你在本例中可能是对的,但我删除了不相关的部分。删除了我的评论,因为它现在没有上下文:)FWIW我认为你得到了正确的答案。