View Full Version : Row results not echoing

09-26-2011, 05:40 PM
row results not echoing correctly

session_start('$id'); ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<LINK href="includes/css/style.css" rel="stylesheet" type="text/css">
<title>Account Dashboard</title>



$con = mysql_connect("$host","$user","$password");
if (!$con)
die('Could not connect: ' . mysql_error());

mysql_select_db("$db_name", $con);
$username= $_row['username']; // Editted

$sql="SELECT * FROM `user` WHERE `username`='{$username}'";

$result = mysql_query("$sql");
<div class= "accountsummary">
if($row = mysql_fetch_array($result)){

echo "ID:";
echo $row['id'];
echo "<BR />";
echo "First Name:";
echo $row['firstname'];
echo "<BR />";
echo "Last Name:";
echo $row['lastname'];
echo "<BR />";
echo "Address:";
echo $row['address'];



<p class="logout">
<a href=logout.php>Logout</a>

<p style="position: absolute; top: 100px; left: 230px; background-color: white; margin: 15px; "> Welcome, <?php echo "$username"; ?> This is your account:<br />
Amazing, really... <br />



09-26-2011, 06:07 PM
"Not correctly" is a rather vague description of what is going on. Perhaps add an else case onto your if where you print the record out to see if that is the call that is failing. Or check the number of rows returned from your query to make sure a record is even being returned.

Old Pedant
09-26-2011, 09:22 PM
This makes no sense:

$username= $_row['username']; // Editted

You have no variable named $_row.


This also makes no sense, though I don't think it is relevant to the problem at hand:

session_start('$id'); ?>

Again, you have no variable named $id.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum