You are here: Re: How do I set a $_SESSION variable « PHP Programming Language « IT news, forums, messages
Re: How do I set a $_SESSION variable

Posted by Rik on 08/13/07 22:57

On Tue, 14 Aug 2007 00:33:48 +0200, Big Moxy <bigmoxy@gmail.com> wrote:

> This is page is called to delete a row on a table using form input. I
> set a session variable based on the result of mysql_query and want to
> pass it back to the caller like this.
>
> if (mysql_query($deleteSQL,$emailmanager) &&
> mysql_affected_rows()>0) {
> $_SESSION["mysql_query_result"] =3D "Your email address has been
> successfully removed";
> }else {
> $_SESSION["mysql_query_result"] =3D "Your email address was not
> found. Please try again";
> }
>
> ....
>
> Here is the return code (generated by Dreamweaver) -
>
> header(sprintf("Location: %s", "http://".$_SERVER['HTTP_HOST'].
> $deleteGoTo));
>
> How do I return the session variable to the caller? The $_SESSION
> array does not exist on return to the caller. I check it using this
> print code -
>
> while ($var =3D each($_SESSION)) {
> printf ("Session key <b>%s</b> has the value of: <b>%s</b><br>",
> $var['key'], $var['value']);
> }

An foreach loop would be less archaic.

To the point: you have to call session_start() on _every_ page.
-- =

Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация