You are here: Re: bidimensional array from query « PHP Programming Language « IT news, forums, messages
Re: bidimensional array from query

Posted by Anna on 02/02/07 21:28

Sanders Kaufman ha scritto:
> Anna wrote:
>
>> After a query, I need to put all data in a bidimensional array this way:
>> every index of the array is an array, so that:
>>
>> my_array[0] is array("data1"=>g,"data2"=>sd,"data3"=>ds)
>
> I don't think you can make the INDEX (key) an array.
> The value - yes, but the key - no.
>
> What you've got there is an "associative" array.



maybe I did not explain well the problem:

<?php
mysql_connect("localhost", "root", "") or
die("Connessione non riuscita: " . mysql_error());
mysql_select_db("db");

$result = mysql_query("SELECT inner_id,data1,data2,data3 FROM test");

$ext = array();


while ($row = mysql_fetch_array($result, MYSQL_NUM)) {

// here I want to transform my result in a bidimensional array
// where $row[0] is an index of an indexed numeric array of arrays
// --->when inner_id is a unique value, it must be a single array,
// --->while, if inner_id is multiple (that is, many records share that
inner_id) the result must be pushed in an array of arrays

// I'm sure it can be done but I don't know how

$ext[$row[0]] = ...

}


?>

 

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

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