Good morning!
Next I have a question, and I am not able to reach conclusion.
I'm creating a field called tag where it fetches tag related posts.
In the bank it is filled as follows;
post1 tag: exemplo1,exemplo2
post2 tag: exemplo3,exemplo2
And how it should be output:
tag: exemplo1,exemplo2,exemplo3
If repaired well, it is separated by a comma. So I make an explode to separate string. So far so good.
My question is in the string part repeating the same.
$query = mysqli_query($con, "SELECT tag FROM posts WHERE tag NOT IN('') ");
while($row = mysqli_fetch_array($query)){
$explode = explode(',',$row['tag']);
$count = count($explode);
for($i = 0; $i < $count-1; $i++){
echo $explode[$i];
}
}
With this code it comes out as follows:
tag: exemplo1,exemplo2,exemplo3,exemplo2
Which way to group repeated string?