Re: Array problem....

From: Date: Thu, 11 Dec 2003 17:15:03 +0000
Subject: Re: Array problem....
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-172497@lists.php.net to get a copy of this message
Yeah I understand that and it would be perfect if I only had to call this type of function once on a page... and on any other pages that need something like this I will do it that way but with the counter set to 0 or whatever number I choose which is a sort of view all page so your solutions works better for this page. Thanks again. Jas Chris W. Parker wrote:
Jas <mailto:jason.gerfen@scl.utah.edu>
    on Thursday, December 11, 2003 7:21 AM said:
Well just so you understand "why" I needed something like that here is the finished result below
[snip]
$i = 0; while(list(...) = mysql_fetch_row(...)) { $_SESSION[$i] = "..."; $i++; }
I want to change my suggestion and recommend that you go along with what John Holmes suggested a little after my post. Read his post again and see if it is helpful to you. Keep note of the following aspect: You can remove the $i = 0; and the $i++; by changing $_SESSION[$i] = "..."; to $_SESSION[] = "...";. i.e. The following two code blocks perform the same task: Current: $i = 0; while(list(...) = mysql_fetch_row(...)) {
    $_SESSION[$i] = "...";
    $i++;
} New: while(list(...) = mysql_fetch_row(...)) {
    $_SESSION[] = "...";
} Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/


« previous php.general (#172497) next »