Anton Heuschen wrote:
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
not sure if this is what you want - but
$sql="your query";
$result=mysql_query;
while ($foo = mysql_fetch_array($result)) {
$bar[]=$foo;
}
then -
$bar[0]['country']
$bar[0]['name']
$bar[0]['population']
would represent one row of your query
$bar[1]['country']
$bar[1]['name']
$bar[1]['population']
would represent another row of your query
etc.
Is that what you are looking for?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php