Hi there
Is there anything I'm doing wrong in the following:
$Database = mysql_connect( "host", "user", "password" ) or
die("Could not connect to database");
mysql_select_db( "dbname", $Database ) or die("Database does not
exist");
$Login = strtolower($_POST["Person"]);
$Password = "PASSWORD(\"" . strtolower($_POST["Password"]) . "\")";
$Query = "SELECT
Ref,Programme,FirstName,LastName,Email,PointsBalance,PointsAvailable FROM
tbusers WHERE Login=\"" . $Login . "\" AND
Password=" . $Password . ";";
$UserResult = mysql_query( $Query, $Database ) or die("Query
failed");
if ( mysql_num_rows( $UserResult ) == 1 )
{
$User = mysql_fetch_assoc($UserResult
$ProgrammeRef = $User["Programme"];
$_SESSION["UserRef"] = $User["Ref"];
... load rest of $User values into $_SESSION array
}
$Query = "SELECT Ref, Programme, ProgrammeLogo, ProgrammeMessage,
Company, CompanyLogo,
CompanyMessage, Website, TableColour, TextColour, NavImage,
Conversion FROM tbprogrammes WHERE Ref=" . $ProgrammeRef . ";";
$ProgrammeResult = mysql_query( $Query, $Database ) or die("Query
failed");
if ( mysql_num_rows( $ProgrammeResult ) == 1 )
{
$ProgrammeInfo = mysql_fetch_assoc($ProgrammeResult);
$_SESSION["ProgRef"] = $ProgrammeInfo["Ref"];
$_SESSION["Programme"] =
$ProgrammeInfo["Programme"];
... load rest of $ProgrammeInfo into $_SESSION array
}
This is the code I'm using to load a total of 18 values into my $_SESSION
array. The initial problem I had
which was intermittent was the $ProgrammeInfo used to be called $Programme
but sometimes when loading
the variables into the $_SESSION array when the code got to
$_SESSION["Programme"] = $ProgrammeInfo["Programme"];
The $Programme[] array used to get screwed up, I could understand it if it
was something that happened all
the time, but it didn't and renaming from $Programme to $ProgrammeInfo seems
to have solved it.
The other point I'd like to make is that a single page is being used to dump
the $_SESSION array and all
I'm doing is refreshing the page and sometimes I get 16 and other times 18
values.
What could cause the two problems, I'm new to php and I like the syntax and
simplicity a lot but these two
problems have me tearing my hair out.
Gavin
Auckland, New Zealand
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php