I am pretty novice at php and hope that I can get some help. When we register a member to our website, we register them with full name, username, password, membership expiration date which goes into a sql database called USERS. Then when they log into the members area, it displayers their username and I want to display that particular users membership expiration date before that. Since I had the session name set with username I just used a simple echo command to display the username such as:
<? echo "Welcome, {$_SESSION['username']}"; ?>
The problem however, is the line beneath that, echoing the currently logged in users expiration date. The code I'm using for it is here:
<?php
// Make a MySQL Connection
mysql_connect("server", "db", "pass") or die(mysql_error());
mysql_select_db("db") or die(mysql_error());
// Retrieve all the data from the "example" table
$result = mysql_query("SELECT `Date` FROM `USERS` WHERE username= ".$_SESSION['username'])
or die(mysql_error());
// store the record of the "example" table into $row
$row = mysql_fetch_array( $result );
echo "Membership Expiration Date: ".$row['date'];
?>
I have edited this to include the code that was shared with me to get the WHERE clause.
The structure of my SQL table has 8 columns, id, username, fullname, password, email, active, code, Date, Hopefully that is what you were looking for.