Ok been playing with this so far I have
<?php
session_start();
if (@$_SESSION['auth'] !="yes")
{
header("location:index.php");
exit();
}
include("db.inc");
$connection = mysql_connect($hostname,$username,$password)
or die ("Could not connect to server");
$db = mysql_select_db($database,$connection)
or die ("Could not connect to database");
$sql = "SELECT FirstName,LastName FROM Distributors
WHERE Username ='{$_SESSION['logname']}'";
$result = mysql_query($sql)
or die("Couldn't execute query for result");
if(mysql_num_rows($result)>0) //there are results returned
{
$row = mysql_fetch_array($result);
extract($row);
}
?>
notice this time I give up hiding names 😛
with a section of HTML code here I have the echo request
<?php echo " Welcome $FirstName $LastName "; ?>
which gives me the error
Notice: Undefined variable: FirstName in E:\domains\w\blah blah blah\current.php on line 34
being the echo line.
now as above the file db.inc includes my server connections, host, password and such. I already know these are correct as the index page requires a login to get to this page current.php.
I've checked and triple checked the spellings for the table and column selections and yet (as far as I can tell) I am getting zero results from my table.
I have added 2 different rows in this table for testing purposes and can use the same select query from phpmyadmin to receive results (obviously without the session) does this mean then that my session is recording the wrong info?
Help me please this is driving me insane 😛
Arnora