Something like this?
while( list( $name, $attempts, $completions, $yards, $td, $int ) =
mysql_fetch_row($res) )
{
$quarterbacks[$name] = array( ATTEMPTS = $attempts,
COMPLETIONS =
$completions,
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
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.
$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
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 ($data
5 matches
Mail list logo