|
|
 |
Re: FN-FORUM: Bizarre goings on with my php sessions
date posted 30th January 2007 11:06
On 30 Jan 2007, at 11:19 am, Duncan Glendinning wrote:
> echo $_SESSION["userID"]."".$userID;
>
> if ($UserOrderID!=''){
> $Query1 = "SELECT * FROM Orders WHERE ID = '".$UserOrderID."'";
> }else{
> $Query1 = "SELECT * FROM Orders WHERE ID='".$_GET["OrderID"]."'";
> }
> $result1 = mysql_query($Query1);
> $row1 = mysql_fetch_assoc($result1);
> extract($row1);
>
> echo $_SESSION["userID"]."".$userID;
>
Hi Duncan,
I just checked the PHP manual for the extract() function and it has
this to say:
http://uk2.php.net/manual/en/function.extract.php
>
>> extract() checks each key to see whether it has a valid variable
>> name. It also checks for collisions with existing variables in the
>> symbol table. The way invalid/numeric keys and collisions are
>> treated is determined by the extract_type. It can be one of the
>> following values:
>>
>> EXTR_OVERWRITE
>>
>> If there is a collision, overwrite the existing variable.
>>
>> EXTR_SKIP
>> If there is a collision, don't overwrite the existing variable.
If I have understood the problem correctly, I think that extract() is
overwriting $_SESSION["userID"] with the value it finds in the table
for userID
Could you rename this column in your table and see if the problem goes
away... or add the EXTR_SKIP parameter to the call to extract()
Best regards,
Ray
------------------------------
Ray McGinty Information Design
Specialising in web application development,
e-commerce and design for print.
http://www.rmid.co.uk
Listed on the Business Link North East England Service Provider Register
|
 |
|