| Posted by gosha bine on 08/28/07 07:58 
On 28.08.2007 05:07 JackpipE wrote:> 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)
 >
 > thanks,
 > Jack
 >
 
 while($row = mysql_fetch_assoc(...))
 $result[ $row['name'] ] []= $row['value'];
 
 hope this helps ;)
 
 
 
 --
 gosha bine
 
 makrell ~ http://www.tagarga.com/blok/makrell
 php done right ;) http://code.google.com/p/pihipi
  Navigation: [Reply to this message] |