<?php
function show() {
require 'path/to/dbconnector.inc';
$sql_subs = mysql_query("SELECT * FROM $t_02",$db)or die(mysql_error());
$i = 0;
while(list($id,$sub,$msk,$dns01,$dns02,$rtrs,$rnge) = mysql_fetch_row($sql_subs)) {
$_SESSION[$i] = "subnet $sub<br>netmask $msk {<br>option domain-name-servers $dns01, $dns02;<br>option routers $rtrs;<br>range $rnge;<br>}<br>";
$i++; }
?>
Then ... <?php call_user_func("show"); echo $_session['0']; echo $_session['1']; ... ?> And you get...
subnet 128.110.22.110 netmask 255.255.255.0 { option domain-name-servers 128.110.22.4, 128.110.29.3; option routers 128.110.22.1; range ; }
Which allows for easy reading of configuration variables and the ability to modify the individual vars using a form etc.
Thanks again for all who gave me some pointers on using numbers instead of names for my session vars.
Jas
Chris W. Parker wrote:
Jas <mailto:[EMAIL PROTECTED]> on Wednesday, December 10, 2003 3:44 PM said:
having no idea you could use numbers as session variable names I kinda feel like a retard right now. You solution worked, thank you very much.
It's an array just like any other which you probably realize now. ;)
Also, unless you're doing some math or something with those variables you might to split them up into their own cells (I don't really know if this is going to be useful for you or not):
{ $_SESSION[$iCtr]['var1'] = $var1; $_SESSION[$iCtr]['var2'] = $var2; $_SESSION[$iCtr]['var3'] = $var3; $_SESSION[$iCtr]['var4'] = $var4; $_SESSION[$iCtr]['var5'] = $var5; ... }
HTH, Chris. -- Don't like reformatting your Outlook replies? Now there's relief! http://home.in.tum.de/~jain/software/outlook-quotefix/
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php