I have created a php login page, login works ok, but i am having a problem as follows.
User logs in and is authenicated, the logged in page displays the username and an account section (that will display the amount in a users account balance).
I am pulling this from a DB, but at the minute it is displaying nothing. it has the username displayed but the amount is not available.
Please see code below
<?php
session_start(username);
$_SESSION['username'];
?>
<html>
<head>
<title>Login Successful</title>
<link rel=stylesheet href="Stylesheet.css" type="text/css">
</head>
<h5>
<?php
$userName=$_SESSION['username'];
echo 'Welcome back : ';
echo $_SESSION['username'];
echo "<br>";
echo 'Current balance , € ';
echo $row['amount'];
[COLOR="Red"]//database connection
$conn = mysql_connect("localhost", "root", "") or die('could not connect to mysql' .mysql_error());
mysql_select_db('customer', $conn) or die('could not connect to DB' .mysql_error());
//this needs to be modified to take the value in the username session
$query = "SELECT 'amount' FROM customerdetails WHERE 'userName' like '$userName' ";
//show user details on my account
$result = mysql_query ($query)
or die ("Query failed: ".mysql_error());[/COLOR]
//displays the amount in users account
while ($row = mysql_fetch_array($result))
{
echo $row['amount'];
}
mysql_close($conn);
?>
</h5>
<table>
<tr>
<td><a href = "myaccount.php" target="showframe" >My Account</a></td><td><a href = "logout.php">Log out</a></td>
</tr>
</table>
</body>
</html>[/SIZE][/SIZE]