i have mysql database with

meta_id 308
post_id 52
meta_key Country
meta_value UK, France, Hong Kong, USA, Taiwan, Malta, Canada

meta_id 396
post_id 60
meta_key Country
meta_value USA, Germany, France, UK, Japan, Canada

the code that i use in php is

$my_country = my_get_meta(‘Country’);
‘, $d, ”; } ?>

the result is “UK, France, Hong Kong, USA, Taiwan, Malta, Canada”

now i only want to extract the first Country in the meta_value so from example above only UK will show

so the result i want is “UK” or “USA” for the second meta

is there anyway i can do it?


Read more here: SQL Comma delimiter in php wordpress


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: