Re: RE:[newbie]session problem

From: Date: Tue, 18 Mar 2003 12:14:30 +0000
Subject: Re: RE:[newbie]session problem
Groups: php.windows 
Request: Send a blank email to php-windows+get-19045@lists.php.net to get a copy of this message
Hiya Futher investigation has lead me to some strange results. I checked phpinfo() and made sure "register global variables is set=on". I then used: //In db api $num_results =mysql_num_rows($db_result); $_SESSION['num_results'] = $num_results; //In second file session_start(); require_once("db_api.php"); echo "THE num_result from db API is ".$_SESSION['num_results']; This seems to work.... when I try and use register_session() such as: //In db api $db_result = mysql_query($querystring); $num_results =mysql_num_rows($db_result); session_register("num_results"); //In second file if (session_is_registered("num_results")) echo "NUM RESULTS is $num_results"; I dont seem to get a value echoed. Not sure why? But hopefully $_SESSION will work now...thanks for all your help Toby and Janet -much appreciated :)
From: toby z <blue_myth_1@yahoo.com> To: Bobby Rahman <bobby_rahman2002@hotmail.com>, php-windows@lists.php.net Subject: Re: [PHP-WIN] RE:[newbie]session problem Date: Tue, 18 Mar 2003 09:05:56 +0000 (GMT) hi try this initiate session on proc.php // init sessn session_start(); // register session variblez ! ! ! ! session_register("SESSN"); chech for session set on sum_page.php <?php // sessn chk ! ! ! ! session_start(); if(!session_is_registered("SESSN")) { // sessn chk failed .... invoke error hndlr ! ! ! ! header("Location: /nologn.php"); exit(); } the rest of ur code ..... ?> hope thid helps good luck toby .... --- Bobby Rahman <bobby_rahman2002@hotmail.com> wrote: > Hiya, Im running php4.2.3 on Win98 and apache 2.0.43. I am having troubles passing variables from page to page. I try to use: session_start(); session_register("test"); when echo $test on a different page it seems to be empty when not called from within the page originally created. I have session_start() on every page at the start just under the php syntax <? and also register the variables which I want global. I have edited the php.ini to set the session.save_path = "C:/windows/temp" and also have global variables set on Any suggestions to what it may be as it doesnt seem to produce any errors. Thanks _________________________________________________________________ Express yourself with cool emoticons http://messenger.msn.co.uk -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
_________________________________________________________________ MSN Messenger - fast, easy and FREE! http://messenger.msn.co.uk

« previous php.windows (#19045) next »