Click here to Skip to main content
15,888,401 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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['']
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 #############################

<?php


require('config/database.php');


# What goes here???


?>
Posted
Updated 28-May-17 21:25pm

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900