pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Lynna Landstreet <lynna@gallery44.org>
To: pgsql-php@postgresql.org
Cc: Andres Ferrando <anferr@mecon.gov.ar>
Subject: Re: Strange session problem
Date: Wed, 11 Aug 2004 16:37:36 -0400
Message-ID: <BD3FFBD0.1766%lynna@gallery44.org> (raw)
In-Reply-To: <411A314B.7090009@mecon.gov.ar>

on 8/11/04 10:46 AM, Andres Ferrando at anferr@mecon.gov.ar wrote:

> Some ideas:
> 
> be sure that the index yo you use in $_SESSION (if any), is integer or
> string, and you aren't using array or similar as index.

It just uses numeric keys - i.e. [0], [1], [2], etc. I assigned the image_id
array from the previous page to $_SESSION directly, as in $_SESSION =
$image_id. And then printed $_SESSION with print_r and everything seemed OK,
but when I go to the next page, $_SESSION is empty.


> how do you go to second page? if you use a header(rediret), you need to
> pass SID explicit.

It goes to the second page by submitting a form.


> if nothing works, try posting code (important parts, as less)

OK. Here it is. I've deleted irrelevant parts, like most of the HTML, and
just replaced them with notes in square brackets:

-------------------------------------------------------------------------

<? session_start(); ?>

[HTML header stuff]
        
<? require_once "/usr/local/www/gallery44db.org/www/resources/db.php"; ?>

[That include file is just the database connection, which is called on every
page]

[More HTML stuff - end of head section, beginning of body, navigation, etc.]
                   
<?

    require_once("includes/login_check.inc.php"); // used on every page
    
    // some more HTML stuff here
    
    $image_id = $_POST['image_id']; // from form on previous page
    
    $image_query = "SELECT image_id, image_path, title
        FROM images WHERE ";
        
    foreach ($image_id as $id) {
        $image_query .=  "image_id = " . $id . " OR ";
        }
        
    $image_query = substr($image_query, 0, -4); // removes the final " or "
    
    $image_info = pg_fetch_all(pg_query($image_query));
    
    // here it displays a table with all the images and their titles
    
    $_SESSION = $image_id;
    
    echo "<pre>\n\nSession Contents:\n\n";
    
    print_r ($_SESSION);
    
    // that works, so as of this part, the correct data is in $_SESSION
    
    echo "</pre>";
    
?>

[a little more HTML]

<form method="post" action="/admin/test.php">

    <input type="submit" name="Submit" value="Yes, I'm sure!">

</form>

[yet more HTML, ending the page]

-------------------------------------------------------------------------

Does that help?


Lynna

-- 
Resource Centre Database Coordinator
Gallery 44: www.gallery44.org
Database Project: www.gallery44db.org





view thread (4+ messages)  latest in thread

Message-ID: <BD3FFBD0.1766%lynna@gallery44.org>
Permalink:  ../BD3FFBD0.1766%25lynna@gallery44.org/
Also on:    postgresql.org/message-id/BD3FFBD0.1766%lynna@gallery44.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: lynna@gallery44.org, anferr@mecon.gov.ar
  Subject: Re: Strange session problem
  In-Reply-To: <BD3FFBD0.1766%lynna@gallery44.org>
  References: <411A314B.7090009@mecon.gov.ar> <BD3FFBD0.1766%lynna@gallery44.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox