I like to hear if there is anyone that can help me out with my problem here.
I like to show the user_information on the protected.php page.
Now I can show the user information but only from line one in the database table, if I try to add the
where `user_name` = '{$user}'"); I just don´t know how to call the $user so it will match the user that is logged in.
<?php include ('core/init.inc.php'); ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title></title> </head> <body> <div> <p> hejsa du er logged ind som <?php echo $_SESSION['username']; ?> </p> </div> <div> <h1>Welcome <?php echo $_SESSION['username']; ?></h1> <p>Username: <?php echo $row['user_name']; ?></p> <p>First name: <?php echo $row['user_firstname']; ?></p> <p>Last name: <?php echo $row['user_lastname']; ?></p> <p>Weight: <?php echo $row['user_weight']; ?></p> <p>Hight: <?php echo $row['user_hight']; ?></p> </div> <?php echo 'log out ? <a href="logout.php">logout here</a>'; ?> </body> </html>This is the code in the user_inc.php file
// this is not a function or class if I put it in a function I get a error on protected.php $query = "SELECT * FROM `users`"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result) or die(mysql_error());Please let me know if you know how to make this work.
Best regards
Wizzuriz.