Re: Array problem....
| From: | John W. Holmes | Date: | Thu, 11 Dec 2003 00:40:47 +0000 |
| Subject: | Re: Array problem.... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-172412@lists.php.net to get a copy of this message | ||
Jas wrote:
but what I need to do is something like this...
<?php
$sql_subs = mysql_query("SELECT * FROM $t_02",$db)or die(mysql_error()); while(list($id,$sub,$msk,$dns01,$dns02,$rtrs,$rnge) = mysql_fetch_row($sql_subs)) {
$_session['<something to automaticly increment session var>'] = "$sub+$msk+$dns01...
}
How about:
$sql_subs = mysql_query("SELECT * FROM $t_02",$db) or die(mysql_error());
while($row = mysql_fetch_row($sql_subs))
{ $_SESSION['data'][] = $row; }
and you can use $_SESSION['data'][1]['id'], $_SESSION['data'][1]['sub'], etc...
If you really want a "+" delimited string in the session, then you can use:
$_SESSION['data'][] = implode('+',$row);
Then row 1 is $_SESSION['data'][0], row 2 is $_SESSION['data'][1], etc.
Kind of begs the question of why you're doing all this, though????
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com