I have a mysql database with a table called keywords -- see below
**** As you can see the row has more than one word listed inside.
MY QUESTION Is there a way to separate each word on it's own using mysql and php. Right now it combines all the words as one instead of individually.
The picture below is showing you words but one button may contain 3 or more words. I need for the words to be unique and on their own. Can this be done in MYSQL? If so can you please provide the php coding, thank you.
you can separate the keyword by comma and space using PHP.
//Split the keyword into array
$keywords_array = explode(", ", $keywords);
//Use array_unique to remove duplicates
$unique_keywords_array = array_unique($keywords_array);
//Print output
foreach($unique_keywords_array as $key) {
echo $key . "<br />";
}
As you didn't share any code, i can give you a simple guess so you can proceed further :-
Get data from your table with php and use explode function to separate each word.
最好的选择是使用explode函数,下面的链接是php网站中explode的参考: http : //php.net/manual/en/function.explode.php
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.