I have a page which is a navigation and displaying sytem for picture galleries. I try to store some arrays in session variable...works perfectly fine with integers bur I have tried many ways for string and none worked...(I use a mysql class to retrive date from the database but it has no influence on my session problem)
here is the code :
<? require_once($_SERVER['DOCUMENT_ROOT']."/_inc/db.Class.php"); ?>
<? require_once($_SERVER['DOCUMENT_ROOT']."/_inc/config.inc.php"); ?>
<?
if (!isset($level))
{
$level=0;
}
$new_level=$level+1;
if (!isset($parent))
{
$parent=0;
}
if ($level!=0)
{
session_start();
$till=$level+1;
$db->sql = "SELECT nom FROM img_cat where id=".$parent;
$q_res_top = $db->fetch_array($db->sql);
if($q_res_top)
{
$titre=$q_res_top['nom'];
if ($level>1)
{
for ($i=1;$i<$level;$i++)
{
$array_id[$i]=$_SESSION["id"][$i];
$array_niv[$i]=$_SESSION["niv"][$i];
//I tried this solution with $_SESSION ["titre"] but it didn't work
}
}
$array_id[$level]=$parent;
$_SESSION["id"]=$array_id;
$array_niv[$level]=$level;
$_SESSION["niv"]=$array_niv;
$array_titre=array("galerie");
if (isset($_SESSION["titre"]))
{
array_push($array_titre,$_SESSION["titre"]);
}
$array_titre[$level]=$titre;
$_SESSION["titre"]=$array_titre;
}
}
?>
<html>
<head>
<title>DYNAM GALERIES</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<?
if ($level!=0)
{
?>
<a href="<? echo $PHP_SELF?>";">galerie</a> | <? for ($i=1;$i<$till;$i++){echo "<a href='".$PHP_SELF."?level=".$_SESSION["niv"][$i]."&parent=".$_SESSION["id"][$i]."'>".$_SESSION["titre"][$i]."</a> | ";}?>
<?
}
?>
<table width="100%" cellpadding="5">
<?
$db->sql = "SELECT * FROM img_cat where id_parent=$parent AND (child='y' OR galerie='y')";
$q_res = $db->query($db->sql);
if($q_res)
{
for($i = 0; $i < sizeof($q_res); $i+=2)
{
?>
<tr>
<?
$end=$i+2;
for($j=$i;$j<$end;$j++)
{
?>
<td><? if ($end>sizeof($q_res) AND $j==$end-1){echo " ";}else { echo "<a href=\"".$PHP_SELF."?level=$new_level&parent=".$q_res[$j]['id']."\">".$q_res[$j]['nom']."</a>";}?></td>
<?
}
?>
</tr>
<?
}
}
else
{
echo "<tr><td cospan='2'>la base est vide</td></tr>";
}
?>
</table>
</body>
</html>
here is an exemple of the code that is generated :
<html>
<head>
<title>DYNAM GALERIES</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<a href="/galerie.php";">galerie</a> | <a href='/galerie.php?level=1&parent=45'>test</a> | <a href='/galerie.php?level=2&parent=46'></a> | <a href='/galerie.php?level=3&parent=48'>test</a> | <table width="100%" cellpadding="5">
<tr><td cospan='2'>la base est vide</td></tr></table>
</body>
</html>
?>
as you can the see the array with integers are stored perfectly in session variables but it doesn't work with strings
Can somebody help???I am desperate...