Session Variables in Function
Posted: Wed Mar 23, 2005 11:53 am
Did a Search but couldn't find an answer on the following ...
Problem:
In a Function, I want to get information, from the database, on a certain member and make these available as session variables. This way they can replace certain keywords on the page.
Q:
How do code the function to make the variables pulled as Session Variables?
In addition, can these be available on the first page, wherein the calls to the database, and the string replacements are on the same page? (because according to the manual, session variables are not available till the second page - utilizing session start)
Code so far ...
Thanks!
SRR
feyd | Please review how to post code using
Problem:
In a Function, I want to get information, from the database, on a certain member and make these available as session variables. This way they can replace certain keywords on the page.
Q:
How do code the function to make the variables pulled as Session Variables?
In addition, can these be available on the first page, wherein the calls to the database, and the string replacements are on the same page? (because according to the manual, session variables are not available till the second page - utilizing session start)
Code so far ...
Code: Select all
function get_member_info()
{
// query database for member info
$conn = db_connect();
$query = "select memid, cbid, coname, firstname, lastname, address, city, state, zip, phone, mememail, otherlink, opfield1, opfield2
from members where memdir = $memdir";
$result = @$conn->query($query);
if (!$result)
return false;
}SRR
feyd | Please review how to post code using
Code: Select all
andCode: Select all
tags. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]