I have a MySQL query that I want to draw an associative array from - 
but I want the 'key' to the array to be the identifying element of 
the row, and I'm stuck on how to get what I want.

For instance:

Each row in the result set contains an id number, a keyword and a 
count related to that keyword.

so in a 'while' loop I can get an associative array like $row["id"], 
$row["word"], etc. with no problem.

However - later (outside of the 'while' loop) I want to be able, 
given the id number, to get the keyword and the count.  Like this 
pseudo code:

   $id_list(1150, 1160, 1170);
   for each $item in $id_list {
      print ($item["word"] : $item["count"]);
   }

The idea is that I want a series of associative arrays that might be 
otherwise set like...

   $1150["word"] = "Blue";
   $1150["count"] = 12;
   $1160["word"] = "Red";
   ...etc....

...except drawn from a MySQL query.

Any ideas how to achieve this?

Thanks for any assistance,
Nelson

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to