[PHP] [php] php.dat

2003-03-24 Thread Gavin Jackson
I had a look in the cgi-bin in the site that's hosting my files and it
contains a binary file called php.dat. Can anyone tell me what the
file is used for?

Regards

Gavin

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Missing session vars when doing var_dump()

2003-03-20 Thread Gavin Jackson
Hi

I have come across a strange problem. I have an application that a user
logs into and when I find the user in the database I load all the custom
info for that use which I store. By the time I'm done, the session array
has 18 key's. When I do a var_dump($_SESSION) I sometimes get
18 variables and sometimes I only get 16. The two fields that are missing
are TEXT fields from a MySQL database and they also appear to be
the last two keys when var_dump() returns all 18 keys.

Does anyone know what is causing this, it's driving me crazy at the
moment with many late nights. The PHP version running is 4.2.3

Regards

Gavin

Auckland, New Zealand


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Missing session vars when doing var_dump()

2003-03-20 Thread Gavin Jackson
Thanks for your input Bobby

I was using mysql_fetch_array() but changed to mysql_fetch_assoc()
The funny thing is, I have a page that does the var_dump() and all
I'm doing is refreshing the page and sometimes I get 18 other times
16 variables


Gavin
Auckland, New Zealand

 -Original Message-
 From: Bobby Patel [SMTP:[EMAIL PROTECTED]
 Sent: Friday, March 21, 2003 11:29 AM
 To:   [EMAIL PROTECTED]
 Subject:  [PHP] Re: Missing session vars when doing var_dump()
 
 I would think that they are 16 key/value pairs when the MySQL (TEXT)
 fields
 are null thus the session variables are NOT set thus NOT present.
 
 Hypothsis: I believe that your are using
 mysql_fetch_array($query_resource),
 try using the second parameter as well ie.
 mysql_fetch_array($query_resource, TYPE_OF_ASSOCIATION) example
 mysql_fetch_array($query_resource, MYSQL_ASSOC) (please see php.net for
 details of mysql_fetch_array).
 
 By using the second parameter, even NULL values will has a variable set.
 
 Example say you had a field called FirstName in the MySQL database. If it
 was NULL, then without the additional parameter you would have NO key
 named
 'FirstName' exisiting (ie it is not set). But if you used the second
 parameter a key would be created with no value (ie it is set but empty).
 
 So remember, the second parameter is OPTIONAL, but it has different
 behaviors when you do (and do not) use it. Hopefully I cleared it up (or
 at
 least shed  some light).
 
 checkout : http://www.php.net/manual/en/function.mysql-fetch-array.php
 
 
 Gavin Jackson [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Hi
 
  I have come across a strange problem. I have an application that a user
  logs into and when I find the user in the database I load all the custom
  info for that use which I store. By the time I'm done, the session array
  has 18 key's. When I do a var_dump($_SESSION) I sometimes get
  18 variables and sometimes I only get 16. The two fields that are
 missing
  are TEXT fields from a MySQL database and they also appear to be
  the last two keys when var_dump() returns all 18 keys.
 
  Does anyone know what is causing this, it's driving me crazy at the
  moment with many late nights. The PHP version running is 4.2.3
 
  Regards
 
  Gavin
 
  Auckland, New Zealand
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] [php]: Loading from array

2003-03-20 Thread Gavin Jackson
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



RE: [PHP] Re: Missing session vars when doing var_dump()

2003-03-20 Thread Gavin Jackson
Hi Bobby

The following is a copy and paste of the page I'm using to
generate the problem. I have 18 keys in the $_SESSION
variable and just by simply refreshing the page with the
following code, it returns either array(0){} or session info and
array(18){ will all the correct variables }. I must be doing
something fundamentally wrong somewhere.

Thanks very much for your willingness to help me.

?php
session_start();
?
html
head
/head
body
?php

foreach( $_SESSION as $key = $value )
{
echo font color=\FF9900\SESSION[$key] = $valuebr;
}
echo brbr;
var_dump( $_SESSION );
?
/body
/html





Gavin Jackson, RD Software Engineer, Tru-Test Ltd.
Phone: +64-9-9788757,  Fax: +64-9-979, [EMAIL PROTECTED]
Tru-Test Ltd, P.O. Box 51-078, Pakuranga, Auckland, New Zealand

 -Original Message-
 From: Bobby Patel [SMTP:[EMAIL PROTECTED]
 Sent: Friday, March 21, 2003 3:28 PM
 To:   [EMAIL PROTECTED]
 Subject:  Re: [PHP] Re: Missing session vars when doing var_dump()
 
 Are the queries the exact same every time you refresh them? This seems
 just
 to be programming logic (I guess). Post some code and maybe someone (or I)
 will be able to help you out.
 
 Gavin Jackson [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Thanks for your input Bobby
 
  I was using mysql_fetch_array() but changed to mysql_fetch_assoc()
  The funny thing is, I have a page that does the var_dump() and all
  I'm doing is refreshing the page and sometimes I get 18 other times
  16 variables
 
 
  Gavin
  Auckland, New Zealand
 
   -Original Message-
   From: Bobby Patel [SMTP:[EMAIL PROTECTED]
   Sent: Friday, March 21, 2003 11:29 AM
   To: [EMAIL PROTECTED]
   Subject: [PHP] Re: Missing session vars when doing var_dump()
  
   I would think that they are 16 key/value pairs when the MySQL (TEXT)
   fields
   are null thus the session variables are NOT set thus NOT present.
  
   Hypothsis: I believe that your are using
   mysql_fetch_array($query_resource),
   try using the second parameter as well ie.
   mysql_fetch_array($query_resource, TYPE_OF_ASSOCIATION) example
   mysql_fetch_array($query_resource, MYSQL_ASSOC) (please see php.net
 for
   details of mysql_fetch_array).
  
   By using the second parameter, even NULL values will has a variable
 set.
  
   Example say you had a field called FirstName in the MySQL database. If
 it
   was NULL, then without the additional parameter you would have NO key
   named
   'FirstName' exisiting (ie it is not set). But if you used the second
   parameter a key would be created with no value (ie it is set but
 empty).
  
   So remember, the second parameter is OPTIONAL, but it has different
   behaviors when you do (and do not) use it. Hopefully I cleared it up
 (or
   at
   least shed  some light).
  
   checkout : http://www.php.net/manual/en/function.mysql-fetch-array.php
  
  
   Gavin Jackson [EMAIL PROTECTED] wrote in message
   news:[EMAIL PROTECTED]
Hi
   
I have come across a strange problem. I have an application that a
 user
logs into and when I find the user in the database I load all the
 custom
info for that use which I store. By the time I'm done, the session
 array
has 18 key's. When I do a var_dump($_SESSION) I sometimes get
18 variables and sometimes I only get 16. The two fields that are
   missing
are TEXT fields from a MySQL database and they also appear to be
the last two keys when var_dump() returns all 18 keys.
   
Does anyone know what is causing this, it's driving me crazy at the
moment with many late nights. The PHP version running is 4.2.3
   
Regards
   
Gavin
   
Auckland, New Zealand
   
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php