You are here: Re: building arrays « PHP Programming Language « IT news, forums, messages
Re: building arrays

Posted by Steve on 08/28/07 03:19

"JackpipE" <pipe.jack@gmail.com> wrote in message
news:1188270433.059195.109550@50g2000hsm.googlegroups.com...
| hello
|
| Is there any simple method in PHP to create arrays from this database
| table:
|
| NAME | VALUE
| nameA | 10
| nameB | 12
| nameB | 10
| nameB | 10
| nameC | 87
| nameC | 56
| ...
|
| so when I do print_r(nameB) I get:
| nameB => array([0]=12, [1]=10, [2]=10)

$example = array();
foreach ($records as $record)
{
$example[$record['NAME']][] = $record;
}

print_r($example['nameB']);

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация