This the following code for member_account.php

in the member_profile.php there is a link for member_account.php, after I login then i can see all information and in the headbar it shows username,account logout home link. but whenever i click to account I can see only logout and home link (i made a binding with server behaviuor) actually there shoulb e username link and user informations. Could you please help me!!!

<?php require_once('../Connections/localhost.php'); ?><?php

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
case "text":
  $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  break;    
case "long":
case "int":
  $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  break;
case "double":
  $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
  break;
case "date":
  $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  break;
case "defined":
  $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  break;
  }

return $theValue;
}
}

$colname_UA = "-1";

if (isset($_GET['id'])) {


$colname_UA = $_GET['id'];
}

mysql_select_db($database_localhost, $localhost);
$query_UA = sprintf("SELECT * FROM users WHERE id = %s", GetSQLValueString($colname_UA, "int"));
$UA = mysql_query($query_UA, $localhost) or die(mysql_error());
$row_UA = mysql_fetch_assoc($UA);
$totalRows_UA = mysql_num_rows($UA);
?><!-- from connection--><!-- upto top connection-->

<!-- from top links-->
<?php
session_start(); // Must start session first thing
/* 
Created By Adam Khoury @ www.flashbuilding.com 
-----------------------June 20, 2008----------------------- 
*/
// See if they are a logged in member by checking Session data
$toplinks = "";

if (isset($_SESSION['id'])) {

// Put stored session variables into local php variable
$userid = $_SESSION['id'];
$username = $_SESSION['username'];
$toplinks = '<a href="member_profile.php?id=' .$row_UA['id']. '">' .$row_UA['username']. '</a> •  
<a href="logout.php">Log Out</a> • 
<a href="index.php">Home</a>';
} else {
echo 'Please <a href="login.php">log in</a> to access your account';
exit();
}
?>
<!-- upto top links-->

<?php
//Connect to the database through our include 

// Query member data from the database and ready it for display
$sql = mysql_query("SELECT * FROM users WHERE id='$userid'"); 

 while($row = mysql_fetch_array($sql)){

$bdusername = $row["username"];
$country = $row["country"];
$state = $row["state"];
$city = $row["city"];

$access = $row["access"];   

$bio = $row["bio"]; 
}

// Give different options or display depending on which user type it is
if ($access == 'a') {
$userOptions = "You get options for Normal User";
} else if ($access == 'b') {
$userOptions = "You get options for Expert User";
} else {
$userOptions = "You get options for Super User";
}
?>

<!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>Member Account</title>
<link href="../style.css" rel="stylesheet" type="text/css" media="all" />
<style type="text/css">
<!--
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
-->
</style></head>
<body>
<!--headercontainer starts here-->
            <div id="headercontainer">
<table style="background-color: #CCC" width="100%" border="0" cellpadding="12">
  <tr>
<td width="78%"><h1>My Logo Image</h1></td>
<td width="22%"><?php echo $toplinks; ?></td>
  </tr>
</table>

</div>
<!--headercontainer end here-->

<!--leftsidecontainer starts here-->

        <div id="leftsidecontainer">

it goes here
</div>
<!--leftsidecontainer end here-->

<!--maincontainer starts here-->
<div id="maincontainer">

<h3><?php echo $row_UA['username']; ?></h3>
<p> </p>
<table width="768" cellpadding="3" cellspacing="3" style="line-height:1.5em;">
  <tr>
    <td width="139" valign="top" bgcolor="#E4E4E4">YOUR ACCOUNT<br />
    <a href="edit_info.php" target="_self">Edit Information </a><br />
<a href="edit_pic.php" target="_self">Edit Picture</a><br />   
<a href="member_profile.php?id=<?php echo $row_UA['id']; ?>" target="_self">View Profile</a><br />  </td>
 <!-- See the more advanced member system tutorial to see how to place default placeholder pic until member uploads one -->
<td width="174" valign="top"><div align="center"><img src="memberFiles/<?php echo $row_UA['id']; ?>/abu.jpeg" alt="Ad" width="150" /></div></td>
<td width="423" valign="top">
Name: <?php echo $row_UA['firstname']; ?>  <?php echo $row_UA['lastname']; ?><br />
  Country: <?php echo $row_UA['country']; ?> <br />
  State: <?php echo $row_UA['state']; ?><br />
  City: <?php echo $row_UA['city']; ?><br />    </td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFFF"> </td>
<td valign="top"> </td>
<td valign="top">Bio:<?php echo $row_UA['bio']; ?><br />
    <br />
  <br /></td>
  </tr>
</table>
<hr />

<!--footer starts here-->
<div id="footer">
© All rights reserved.
</div>
<!--footer end here-->

</div>
<!--maincontainer end here-->

<!--rightsidecontainer starts here-->
<div id="rightsidecontainer">
it goes here
</div>
<!--rightsidecontainer starts here-->

</body>
</html>
<?php
mysql_free_result($UA);
?>

Recommended Answers

All 2 Replies

Are you sure $_GET['id'] is set and is the correct value, so we have a valid $query_UA?

I think that <a href="member_profile.php?id=' .$row_UA['id']. '">' .$row_UA['username']. '</a> is being echoed successfully (as logout is visible), but there is no value for $row_UA['username'] so you end up with:

<a href="member_profile.php?id="></a>

This of course, will not be visible and would explain your problem.

Sir, I did changed to <a href="member_profile.php?id="></a> but doesnot work. Still I can go all pages as a logged member. but does not get info from phpadmin.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.