RE: session variables - help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Ford, Mike [mailto:M.Ford@xxxxxxxxxxxxxx]
> Sent: 14 August 2009 11:45


> > Now, here is the update_order.php code in entirety:
> >
> > [code]
> >
> > <?php
> > session_start();
> > foreach ($_SESSION as $var => $val) {
> >  if ($val == "0") {
> >   unset($_SESSION[$var]);
> >  } elseif ($val == '') {
> >   unset($_SESSION[$var]);
> >  } else {
> >   $val = $_SESSION[$var];
> 
> That line is back-to-front -- you're assigning the current value in
> the session to $val, which is then immediately thrown away as the
> foreach loop starts a new iteration. What you mean is
> $_SESSION[$var] = $val.

No, wait a minute, hold your foot up!  I was so focussed on the strange assignment that I didn't read the whole thing properly.  What you're *actually* doing here is -- er, well, totally not what you want to, I suspect! Having re-read the message I responded to, I'm going to go back to it and post another response....


Cheers!

Mike
 -- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Leeds Metropolitan University, C507, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom 
Email: m.ford@xxxxxxxxxxxxxx 
Tel: +44 113 812 4730





To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux