gpt4 book ai didi

php - 它确实显示了一个用户,但它显示了我在 table 上的所有用户,我只是在寻找一个带有 $_session 的用户

转载 作者:行者123 更新时间:2023-11-29 19:30:04 25 4
gpt4 key购买 nike

I want to show the info from a espesific user and I have a $_session working fine but with a table and in this case I want not to use a table I must like use a CSS div and when I did test it show me this error Notice: Undefined index: usuario in when this "usuario" como from the login index file

<?php


require("conection/connect.php");

session_start();


$sql="SELECT stu_id,
f_name,
s_name,
l_name,
sl_name,
gender,
dob,
pob,
address,
phone,
email,
note
from tblstudents
where stu_id"; //i want to use a where stu_id='".$_SESSION['usuario']."'"; but it is not working show me Notice: Undefined index: usuario in C:\xampp\htdocs\studentskin\infostudent.php on line 2
$infostudent=mysql_query($sql); // but when I did a test with where stu_id"; it is showing me the all users that I have on the table


?>

<html>
<head><center><h3>Alumno</h3></center></head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>::. Secundaria 10 .::</title>
<link href="css/backgroundcolor.css" />
<body>
<center>
<?php

while ($tblstudents=mysql_fetch_assoc($infostudent)){

echo $tblstudents['stu_id'].
"<div>".$tblstudents['f_name']." ".$tblstudents['s_name']." ".$tblstudents['l_name']." ".$tblstudents['sl_name']."</div>";
echo"";
}
?>

//我想使用 $_session 登录并显示我已记录的信息

最佳答案

    <?php
require("conection/connect.php");

session_start();

$sql="SELECT
`stu_id`,
`f_name`,
`s_name`,
`l_name`,
`sl_name`,
`gender`,
`dob`,
`pob`,
`address`,
`phone`,
`email`,
`note`
from tblstudents
where stu_id='".$_SESSION['usuario']."'";

$records=mysql_query($sql);

?>




<html>
<head><h1>Informacion</h1></head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>::. Secundaria 10 .::</title>
<body>

<div>
<center>

<?php

while ($tblstudents=mysql_fetch_assoc($records)){


echo "<div>".$tblstudents['stu_id']."<div>";
echo "<div>".$tblstudents['s_name']." ".$tblstudents['s_name']." ".$tblstudents['l_name']." ".$tblstudents['sl_name']."</div>";
echo "<div>".$tblstudents['gender']."</div>";
echo "<div>".$tblstudents['dob']."</div>";
echo "<div>".$tblstudents['pob']."</div>";
echo "<div>".$tblstudents['address']."</div>";
echo "<div>".$tblstudents['phone']."</div>";
echo "<div>".$tblstudents['email']."</div>";
echo "<div>".$tblstudents['note']."</div>";




}

?></center>
</body>
</div>
</html>

关于php - 它确实显示了一个用户,但它显示了我在 table 上的所有用户,我只是在寻找一个带有 $_session 的用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41846267/

25 4 0