简体   繁体   中英

Get unique values from MySQL column

I have the following information in a MySQL column:

**rubros**
Internet
Internet, Diseño
Arquitectura, Construcción
Textiles

And I need to get an array of individual ítems in that list, something like this:

array('Internet','Diseño','Arquitectura','Construcción','Textiles');

Is there an easy way to do this with PHP?

Thanks.

As Marc B suggest, assuming the DB query result is in $values, something like this would do the job:

$result = array();
foreach($values as $value) $result = array_merge($result, explode(", ", $value));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM