|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1999-12-22 22:19 UTC] sas at cvs dot php dot net
[1999-12-23 07:55 UTC] gbonanse at tesetec dot com dot br
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 05:00:01 2025 UTC |
I have the folowing function: function renewloc ($lset,&$l,&$ld) { $db = mysql_connect(); mysql_select_db("cefac",$db); $sqls = "SELECT locid,locnome FROM locais ORDER BY locid"; $result = mysql_query($sqls,$db); $row = mysql_fetch_row($result); if ($lset) { $l = $row[0]; $ld = $row[1]; } $larr = ''; do { $larr = $larr . $row[0] . "|" . $row[1] . "@"; } while ($row = mysql_fetch_row($result)); mysql_close($db); return substr($larr,0,strlen($larr)-1); } The function works well, set the referenced variables and returns a result. Within the page from which the function was called I can play with the result, but if I set a session variable with this result, the session file is written with this value as an integer with value 0; If I use the following code: include('funct.inc'); $myvar = renewloc(true,$mg_loc,$mg_locd); where 'funct.inc' is the include page where I have the renewloc function defined, $tmp has the right value as soon as the function returns, but now look at this code: session_register('myvar'); session_register('mytest'); include('funct.inc'); $myvar = renewloc(true,$mg_loc,$mg_locd); $mytest = 'testing'; myvar has the right value, but on the next page, only the mytest value is held. myvar is written as an integer value that contains 0. If I substitue the function by its code directly on the page everything works fine. Maybe this is a problem inserted on the last changes of referencing variables.