Profile System Errors
Posted: Sat Jun 30, 2012 1:10 pm
Hey guys!
I was following along with the Youtube Video and I came across some unique errors that I could not find the answer to here.
So now I am displaying it.
User_list.php
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/content/66/9481266/html/source/user.inc.php on line 37
Username
Gender:Female
Location:
About:
Anyone can take a stab at this?
Here is the profile page.
I was following along with the Youtube Video and I came across some unique errors that I could not find the answer to here.
So now I am displaying it.
User_list.php
<?php session_start(); $con = mysql_connect("/*snip*/","/*snip*/","/*snip*/"); if (!$con) { die('Could not connect: ' . mysql_error()); } if (!mysql_select_db("ytrmembership")) { echo "Unable to select mydbname: " . mysql_error(); exit; } mysql_select_db("ytrmembership", $con); function fetch_users(){ $result = mysql_query("SELECT `id_user` AS `id`, `username` AS `username` FROM `fgusers3` "); $users = array(); while (($row = mysql_fetch_assoc($result)) !== false){ $users[] = $row; } return $users; } function fetch_user_info($uid){ $uid = (int)$uid; $sql = "SELECT `username` AS `Username`, `email` AS `email`, `user_about` AS `About`, `user_location` AS `location`, `user_gender` AS `gender` FROM `fgusers3` WHERE `user_id`= {$uid}" ; $result = mysql_query($sql); return mysql_fetch_assoc($result); <--- error here } ?>error: This is what the page looks like
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /home/content/66/9481266/html/source/user.inc.php on line 37
Username
Gender:Female
Location:
About:
Anyone can take a stab at this?
Here is the profile page.
<?php include('profiledb.php'); $user_info = fetch_user_info($_GET['uid']); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content=text/html; charset=utf-8" /> <title><?php echo $user_info['Username']; ?>'s Profile</title> </head> <body <div> <?php if (!$sql === NULL){ echo 'That user does not exist.'; } else { ?> <h1><?php echo $user_info['username']; ?></h1> <p>Username</p> <p> Gender:<?php echo ($sql['gender'] == Male) ? 'Male' : 'Female'; ?></p> <p>Location: </p> <p>About:</p> <?php } ?> </div> </body> </html>password and database hidden for security purposes