|
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]
|