Assign 2 values from Mysql to an array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This might sound trivial, but for the live of me cant seem to get it to
work, and I am not familiar with such a thing.

What I have is a query lets say :

select  country,name,population from USERS where id= 'some_id' ";


Now I want to assign the result to one set (The above example might have 3+
entries per telephone, thus what would be nice is something like an array of
:


[id][country][name]  = population .......... or to be exact if I echo the
value for each id and country and name to get the population value


Like :

Array {

  [id] array {
         [country] array {
                    [0] = USA
          }
  [name] array {
         [0] = test

  }

}




I dont know something like that, maybe Im over comlicating the question now
even, the main thing is wondered was in the first place was with a standard
query and variable assign, from the query like:

select  country,name,population from USERS where id= 'some_id' ";

normally you would just assign each field to one variable. like

$country = result["country"]
$name = result["name"]


But now I want all 3 fields as one variable (which would be an array) ..but
how ?

I hope I have not totally confused the question now.

Thanks in advance

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux