The Most Active and Friendliest
Affiliate Marketing Community Online!

“Propeller”/  Direct Affiliate

problem with Sessions

StevieB

New Member
affiliate
I'm trying to output sessions "row 0" "row 1" etc and all I get is either a blank output or "Array"

This was working before I put the loop in.
I think there's a problem with ['row '.$i]
I've tried
$row = "row ";
$row = $row.$i - but that doesn't work either.

Can anyone see where i'm going wrong?


The php is -

$query = " SELECT * FROM table ORDER BY RAND() LIMIT 1 ";
for($i = 0; $i <= 2; $i++)
{
if($result = mysql_query($query))
{
while( $output = mysql_fetch_row($result) )
{
// create name and output to session
$_SESSION ['row '.$i] = $output;
}
mysql_free_result($result);
}
}


the output page is

echo $_SESSION['row 0'];
echo ' <br>';
echo $_SESSION['row 1'];
echo ' <br>';
echo $_SESSION['row 2'];
echo ' <br>';

I can't think of any other way of creating row 0, row 1 in the loop.

Thanks in advance.
Steve.
 
banners
Back