Home > Archive > PHP DB > May 2007 > Extracting data from Arrays in ISAM table
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Extracting data from Arrays in ISAM table
|
|
| boclair@boclair.com 2007-05-19, 6:57 pm |
| I have a table with between 100k and 200k rows. One field, `names`, is
populated, in each row, with an imploded array of up to 4 names.
I require to create a list of names, without repeats, of all the names
in `names` field to use in an html form.
Any advise would be appreciated. I have no ideas on how to start.
Louise
| |
| itoctopus 2007-05-20, 7:58 am |
| Step #1: Select name_field FROM the_table;
Step #2:
$arr_all_names = array();
foreach single_result in your result_set{ //you have to translate this into
php
$arr_name = explode(',', $single_result['name']); //assuming that you
are joining names in the field using a comma
$arr_all_names = $arr_all_names + $arr_name;
}
//remove redundancy
$arr_all_names = array_unique($arr_all_names);
//now sort the array
sort($arr_all_names);
//now all you have to do is to loop through the array to display it on your
site
--
itoctopus - http://www.itoctopus.com
<boclair@boclair.com> wrote in message news:464F7825.6090200@boclair.com...
>I have a table with between 100k and 200k rows. One field, `names`, is
> populated, in each row, with an imploded array of up to 4 names.
>
> I require to create a list of names, without repeats, of all the names
> in `names` field to use in an html form.
>
> Any advise would be appreciated. I have no ideas on how to start.
>
> Louise
>
>
>
>
|
|
|
|
|