Sessions and MySQL query results....
Posted: Sun Mar 07, 2004 3:53 pm
Some how i cant get to print MySQL results using session values on the print statement...Heres the deal..
My config contains:
$lang_default = "en";
My header file contains:
PHP Code:
if (!session_is_registered('lang')){
$lang = $lang_default;
session_register('lang');
}
if (isset($new_lang)) {
$lang = "lang_".$new_lang.".php";
session_register('lang');
}
And all works fine. Ive checked with print_r($_SESSION);
Now the deal its this function in functions file:
PHP Code:
function makemenu(){
//include_once ("session_mysql.php");
session_start();
include ("config.php");
$menu2SQL= "SELECT * FROM config WHERE id='1'";
$blaman=mysql_query($menu2SQL);
while ($rekord=mysql_fetch_array($blaman))
{
$color2 = $rekord[color2];
}
$menu2SQL= "SELECT * FROM menu ORDER BY ordernr";
$blaman=mysql_query($menu2SQL);
while ($rekord=mysql_fetch_array($blaman))
{
if ($rekord[doshow]=="1"){
print "<TD bgColor=#$color2 height=\"2\">
<P align=center> <A
href=";
if ($rekord[link] == ""){
echo "index.php";
}
else{
print "$rekord[link]";
}
////HERE IS MY PROBLEM . THIS SHOWS NOTHING...
print ">$rekord[$lang]</A> </P></TD>";}
}
}
If i dont use sessions it works perfectly.......
Can someone help..Thanxxxxxxxxxxxxxxxxxx
My config contains:
$lang_default = "en";
My header file contains:
PHP Code:
if (!session_is_registered('lang')){
$lang = $lang_default;
session_register('lang');
}
if (isset($new_lang)) {
$lang = "lang_".$new_lang.".php";
session_register('lang');
}
And all works fine. Ive checked with print_r($_SESSION);
Now the deal its this function in functions file:
PHP Code:
function makemenu(){
//include_once ("session_mysql.php");
session_start();
include ("config.php");
$menu2SQL= "SELECT * FROM config WHERE id='1'";
$blaman=mysql_query($menu2SQL);
while ($rekord=mysql_fetch_array($blaman))
{
$color2 = $rekord[color2];
}
$menu2SQL= "SELECT * FROM menu ORDER BY ordernr";
$blaman=mysql_query($menu2SQL);
while ($rekord=mysql_fetch_array($blaman))
{
if ($rekord[doshow]=="1"){
print "<TD bgColor=#$color2 height=\"2\">
<P align=center> <A
href=";
if ($rekord[link] == ""){
echo "index.php";
}
else{
print "$rekord[link]";
}
////HERE IS MY PROBLEM . THIS SHOWS NOTHING...
print ">$rekord[$lang]</A> </P></TD>";}
}
}
If i dont use sessions it works perfectly.......
Can someone help..Thanxxxxxxxxxxxxxxxxxx