OK, I think I can see what you are trying to do. However, your code is doing the following:mthierfelder wrote:Code: Select all
<? require_once("conn.php"); require_once("includes.php"); require_once("templates/HeaderTemplate.php"); //WELCOME GREETING $data = mysql_query("SELECT * FROM yellow_agents") or die(mysql_error()); $info = mysql_fetch_array($data); /*while($info = mysql_fetch_array($data))*/ { if (empty($_SESSION['AgentID'])) { //empty echo 'Welcome, guest!'; } else { echo '<table border="0" cellpadding="0" cellspacing="0" width="100%" style="border: 1px dashed #cccccc; margin: 10px; padding: 10px;">'; echo '<tr>'; echo '<td valign="top">Welcome Back, ' . $info['FirstName'] . '<br><br>'; echo 'Account Status: ' . $info['AccountStatus'] . '</td></tr></table>'; } } ?>
- Including 'conn.php' (DB connection details I assume)
- Including 'includes.php' (Functions, constant, etc I assume)
- Including 'templates/HeaderTemplate.php' (Your markup I assume)
- Grabbing all records that are in the yellow_agents table and reading the resource into a variable called $data
- Reading the resulting array of records into an array var called $info
- Checking to see if there is no value for a session var called 'AgentID'
- If there is no value then echoes out a generic text messsage
- If there is any value at all in the session var (including a single space character), echoes out a custom message with an unknown array var value from the query result $info