monetizer expertmobi
Dismiss Notice
Welcome to Our Community
Wanting to join the rest of our members? Feel free to sign up today.

problem with Sessions

Discussion in 'General Affiliate Marketing Forum' started by StevieB, Sep 21, 2007.

  1. StevieB

    StevieB Affiliate affiliate

    5
    0
    0
    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.
     
  2. monetizer

Featured Resources (View All)

MI