I'm trying to build a page for user profiles, but I'm having difficulties.
I do not want to create the profile for the user just logged, but permanent user profiles, where you can then watch them all.
type: profile.php? id = 1
I'm using UserPie, which can be found on github.
Actually my profile.php page is this:
<?php require_once("models/config.php");
$id = $_GET['id']);
if (empty($_GET['id'])){
header("Location: index.php");
die();
}
$sql = "SELECT * FROM users WHERE user_id != '$id'";
$result = mysqli_query($db, $sql) or die(mysqli_error($db));
while($rws = mysqli_fetch_array($result)){
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $rws["username"]; ?> - <?php echo $websiteName; ?></title>
<?php require_once("head_inc.php"); ?>
</head>
<body>
<?php require_once("navbar.php"); ?>
<?php if (is_null($sql)): ?>
<h3 class="page-header">ERROR</h3>
User not found!
<?php else: ?>
<h1>Welcome</h1>
<p>ID: <?php echo $rws['user_id']; ?></p>
<p>Welcome to your account page <strong><?php echo $rws['username']; ?></strong></p>
<p>You joined on <?php echo date("l \\t\h\e jS Y", $rws['sign_up_date']); ?> </p>
<?php endif; ?>
<?php } ?>
I cannot make it work.
Do you have any suggestion?
I solved in this way:
$sql = "SELECT * FROM users WHERE user_id = '$id'";
$result = $db->sql_query($sql);
while($rws = mysqli_fetch_array($result)){
if(is_null($sql)):could be wrong? - D4V1D$id = $_GET['id']);there is a syntax error. it will be$id = $_GET['id'];Do you have any error?? then it will be easy for some one to give solution. - Tintu C Raju