Re: Multidimensional arrays

From: Date: Fri, 18 Jul 2003 23:40:38 +0000
Subject: Re: Multidimensional arrays
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-155853@lists.php.net to get a copy of this message
Gary Broughton <gbroughton@footymad.net> wrote: > Hi > > Many thanks for your time Matt. I tried that method amongst a few > others, and couldn't seem to get it right. What I have eventually come > across is the function 'array-push' (bizarre!) to add a new array line > for each record (after it's been initially defined). It seems to work > for me, and hopefully it is the correct, standard way to do such a task. > > $strCusts = array(array('id','name')); > /* setting up empty array for cust id and name */ > if (mysql_num_rows($resCusts) > 0) { > $intCusts = mysql_num_rows($resCusts); > /* store the number of records retrieved */ > while ($oRsCusts = mysql_fetch_array($resCusts)) { > > array_push($strCusts,array($oRsCusts["id"],$oRsCusts["name"])); /* add > new array row */ thats to complicated just use: $strCust[] = $osRsCusts;

« previous php.general (#155853) next »