On Thu, 2006-12-21 at 14:54 +0200, Yonatan Ben-Nes wrote:
> Hi all,
>
> I got a problem with creating a multidimensional array which it's size is
> unknown.
> I already made it work like this (example):
> $array = array('six','five','four','three','two','one');
>
> for ($i = count($array)-1; $i
you can do this with a bit of reference magic...
there might a cleaner/better way - if anyone can correct me I'd
be glad to learn :-)
Yonatan Ben-Nes wrote:
> Hi all,
>
> I got a problem with creating a multidimensional array which it's size is
> unknown.
> I already made it work like this (ex
Oops.. my bad
$quarterbacks[$data['NAME']][$key] = $value;
Mike
Mike Eheler wrote:
> $result = mysql_query("select NAME,ATTEMPTS,COMPLETIONS,YARDS,TD,INT
> from players where pos = 'QB'");
> // or whatever it takes to get just qb's
> while ($data = mysql_fetch_array($result)) {
>foreach ($
$result = mysql_query("select NAME,ATTEMPTS,COMPLETIONS,YARDS,TD,INT
from players where pos = 'QB'");
// or whatever it takes to get just qb's
while ($data = mysql_fetch_array($result)) {
foreach ($data as $key => $value) {
// I've noticed that $data stores numeric and text keys, this
you could also do this ...
$data = mysql_fetch_assoc($res); //this is a nice function because it
returns an associative array. so
// if you change your SQL db, you
wouldn't need to change your php code
// as much.
$quarterbacks[$
Not sure what you are trying to do, but try using
mysql_fetch_row ()
you can use SQL to limit your results.
/dkm
- Original Message -
From: "J. Roberts" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, December 06, 2001 4:08 PM
Subject: [PHP] Creating multidimensional array
Something like this?
while( list( $name, $attempts, $completions, $yards, $td, $int ) =
mysql_fetch_row($res) )
{
$quarterbacks[$name] = array( "ATTEMPTS" => $attempts,
"COMPLETIONS" =>
$completions,
7 matches
Mail list logo