RE: [PHP-DB] Array problem...

2005-09-18 Thread Bastien Koert
Dunno if its relevant, but the recommended way to use sessions is to assign 
stuff to a $_SESSION['varname']...I don't really see anything wrong with the 
code...


Also, what arrays are causing the problems?

bastien



From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Array problem...
Date: Fri, 16 Sep 2005 09:04:34 -0500

I am migrating a web app from an old server running PHP 4.2.3 to
a new server running 4.3.8.  The problem I am running into at the moment
is building an array and passing it to another page.  This code works
fine on the old server, but the array is not coming across to the new
page on the new server.  Help...

mysql_select_db($database, $Prod);
$shell_list = getEnumOptions('accounts','shell');
$shell_tmp = select size=\1\ name=\shell[]\\n;
$shell_tmp .= optionDefault Shell/option\n;
$shell_tmp .= option-/option\n;
foreach ($shell_list as $item) {
  $shell_tmp .= option$item/option\n;
}
$shell_tmp .= /select\n;

$query_groups = SELECT name FROM grps;
$groups_tmp = mysql_query($query_groups, $Prod) or die(mysql_error());
$grp_list = select size=\1\ name=\grp[]\\n;
$grp_list .= optionPrimary Group/option\n;
$grp_list .= option---/option\n;
while($item2 = mysql_fetch_row($groups_tmp)) {
  $grp_list .= option$item2[0]/option\n;
}
$grp_list .= /select\n;

SNIP

?php
  while (isset($_POST['system'][$cntr])) {
echo td width=\20%\div align=\center\font
class=\style3\.$_POST['system'][$cntr]./font/div/td;
echo td width=\20%\div
align=\center\.$shell_tmp./div/td;
echo td width=\20%\div
align=\center\.$grp_list./div/td;
echo td width=\20%\div align=\center\input
type=\text\ name=\other[]\ value=\\ size=\15\/div/td/tr;
$tmp = $sbcuid.-.$_POST['system'][$cntr];
$cntr++;
array_push( $accnts, $tmp );
  }
?
/table
p align=centerfont class=style3strongIf the systems listed
above are correct, please
proceed. Otherwise, please hit the Back button on your browser and
review your
system selections again./strong/font/pp
align=centernbsp;/p
?php
  session_register(accnts, shell, grp, other, cntr);
?

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] array problem

2002-06-21 Thread Jason Wong

On Thursday 20 June 2002 23:26, Richard Black wrote:
 By passing a second parameter to mysql_fetch_array, MYSQL_ASSOC

 This means you only get back an array with the values indexed by
 fieldname.

Or just use mysql_fetch_assoc().

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
disks spinning backwards - toggle the hemisphere jumper.
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php