These are my files:
user_list.php:
<?php error_reporting(E_ALL ^ E_WARNING) ; include ('/core/init.inc.php') ; ?> <html> <head> <title>Registered Users!</title> </head> <body> <div> <?php foreach (fetch_users() as $user) { ?> <p> <a href="profile.php?uid=<?php echo $user['id'] ?>" ><?php echo $user ['username'] ; ?></a> </p> <?php } ?> <div> </body> </html>init.inc.php:
<?php error_reporting (E_ALL ^ E_NOTICE) ; session_start () ; $c_username = "user"; $c_password = "pass"; $c_host = "localhost"; $c_database = "dbname"; $connection = mysql_connect($c_host, $c_username, $c_password) or die ("It seems this site's database isn't responding." ); mysql_select_db($c_database, $connection) or die ("It seems this site's database isn't responding." . mysql_error()); $path = dirname (__FILE__); include ('{$path}/inc/user.inc.php') ; $_SESSION ['uid']= 1 ; ?>user.inc.php
<?php // fetches all of the users from the table! function fetch_users() { $result = mysql_query ("SELECT `user_id` AS `id`, `user_username` AS `username` FROM `users`") ; $users = array () ; while (($row = mysql_fetch_assoc($result)) !== false) { $users [] = $row ; } return $users ; } function fetch_user_info ($uid) { $uid = (int)$uid; $sql = "SELECT `user_username` AS `username`, `user_firstname` AS `firsntame`, `user_lastname` AS `lastname`, `user_email` AS `email`, `user_about` AS `about`, `user_location` AS `location`, `user_gender` AS `gender` FROM `users` WHERE `user_id`= ($uid)" ; $result = mysql_query($sql) ; return mysql_fetch_assoc($result) ; } //updates the current users proifle function set_profile_info ($email, $about, $location){ $email = mysql_real_escape_string (htmlentities($email)) ; $about = mysql_real_escape_string (nl2br(htmlentities($about))). $location = mysql_real_escape_string ($location) ; $sql = "UPDATE `users` SET `user_email` = '{$email}' , `user_about` = '{$about}', `user_location` = '{$location}' WHERE `user_id` = {$_SESSION ['uid']}" ; mysql_query ($query) ; } ?>and the profile.php and edit_profile.php