session variable

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I have following problem:
I try to retrieve images from mysql and show it.
I retrieve them in loop using getData.php.
getData.php uses session variable ($_SESSION['num']) to get image.

However $_SESSION['num'] seems to be always 0.

<head><title>Show data from SQL Database</title></head>

    $sql = "SELECT count(id) FROM store;";
    $result = MYSQL_QUERY($sql);
    $count = MYSQL_RESULT($result,0,"count(id)");

//here is loop where $_SESSION['num'] is set and getData.php called

    while($count >1) {
    echo $_SESSION['num'];
    <IMG SRC="getData.php">


if(isset($_SESSION['num'])) {



    $query = "select FileData,filetype from store where id=$num";
    $result = @MYSQL_QUERY($query);

    $data = @MYSQL_RESULT($result,0,"FileData");
    $type = @MYSQL_RESULT($result,0,"filetype");

    Header( "Content-type: $type");
    echo $data;

Re: session variable

On 25 Aug 2004, much to the astonishment of all present at comp.lang.php,
ak blurted:

Quoted text here. Click to load it

I don't know if you have to use the line $_SESSION['cart'][] = array();
but this seemed to help me in a similar situation.

if (!isset($_SESSION['count'])) {
   $_SESSION['count'] = 1;
} else {

$_SESSION['cart'][] = array();
$_SESSION['cart'][$count] = $item;

for ($n = 1; $n <= $count; $n++) {

Site Timeline