登录后如何在其他页面中显示用户数据? [英] How do I display users data in another page after the login?
问题描述
大家好,我正在建立一个社交网络,我在这里,因为我有$ _SESSION ['']的存货; 。我尝试在连接后在他们的个人资料页面中显示用户数据,但
Hi everyone, I'm making a social network and I'm here because I'm stock with the $_SESSION['']; . I try to display the users data in their profile page after the connection but
$_SESSION['']
不起作用,我不知道在哪里投入使用。登录系统工作,只是数据显示问题。我想在profile.php中显示用户名。
登录代码如下:
我尝试过:
doesn't work, I don't know where to put it to work. The login system work, it's just the datas display the problem. I want to display the username in profile.php .
The login code is below:
What I have tried:
<?php
require('congig/database.php');
if(isset($_POST['submit'])){
$email = $_POST['email'];
$password = $_POST['password'];
$query = "select * from database.users WHERE email='$email' AND password= '$password' " ;
$query_run = mysqli_query($db,$query) ;
if(mysqli_num_rows($query_run)>0){
function show_records($db){
$email = $_POST['email'];
$q = "select*from database.users WHERE email='$email'";
$r = mysqli_query($db,$q);
if($r){
echo '<h1>Les infos de la table users</h1>';
while($row = mysqli_fetch_array($r,MYSQLI_ASSOC)){
header('location:profile.php?u='.$row['username']);
}
}else{
echo '<p>'.mysqli_error($dbbc). '</p>';
}
}
show_records($dbbc);
mysqli_close($dbbc);
}else{
echo 'Not connected';
}
}
?>
############## ############## profile.php #############################
############################ profile.php #############################
<?php
require('config/database.php');
# What goes here???
?>
推荐答案
_SESSION ['']; 。我尝试在连接后在其个人资料页面中显示用户数据,但
_SESSION['']; . I try to display the users data in their profile page after the connection but
_SESSION ['']
_SESSION['']
不起作用,I不知道把它放在哪里工作。登录系统工作,只是数据显示问题。我想在profile.php中显示用户名。
登录代码如下:
我尝试过:
doesn't work, I don't know where to put it to work. The login system work, it's just the datas display the problem. I want to display the username in profile.php .
The login code is below:
What I have tried:
<?php
require('congig/database.php');
if(isset(
_POST ['submit'])){
_POST['submit'])){
这篇关于登录后如何在其他页面中显示用户数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!