I am trying to get user's information and show them in user's profile. And i found this query but it is in PDO and my work is in sqli here the query :
if(isset($_SESSION['user'])){
$getuser=$con->prepare("SELECT * From users where username=?");
$getuser->execute(array($sessionuser));
Sinfo=$getuser->fetch();
And here the whole code
<?php
session_start();
$sessionuser='';
if(isset($_SESSION['user'])){
$sessionuser=$_SESSION['user'];
}
if(isset($_SESSION['user'])){
$getuser=$con->prepare("SELECT * From users where username=?");
$getuser->execute(array($sessionuser));
Sinfo=$getuser->fetch();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
Username:<?php echo $info['username']?>
Email:<?php echo $info['email']?>
Register Date:<?php echo $info['reg_date']?>
Password:<?php echo $info['password']?>
</body>
</html>
<?php
}else{
header("Location: login.php");
}
?>