0
I wanted to separate each name by commas inside an array, I tried so no more
echo '<h1>'.$nomeTemporada.'° Temporada</h1>';
if(isset($_GET['id_temporada'])){
$id = $_GET['id_temporada'];
}
$episodios = mysqli_query($conn,"SELECT * FROM `episodios` WHERE `id_temporada` = '$urlE[4]' AND `slug` = '$urlE[1]' AND `audio_temporada` = '$urlE[3]'");
while($res = mysqli_fetch_assoc($episodios)){
$idTemporada = $res['id_temporada'];
$nomeEpisodio = $res['nome_episodio'];
$slugTemporada = $res['slug'];
$slugEpisodios = $res['slug_episodios'];
$episodioTemporada = $res['episodio_temporada'];
$audioTemporada = $res['audio_temporada'];
if(isset($urlE)){
$episodioAtual = $urlE[2];
$ep = [rtrim(''.$nomeEpisodio.'',',')];
var_dump($ep);
foreach ($ep as $palavra){
if($episodioAtual == $palavra){
$palavra = preg_replace('/[-]/ui', ' ', $palavra);
echo '<a href="javascript:void(0)" style="text-transform:capitalize;color:red;">'.$palavra.'</a>'.PHP_EOL;
}else{
echo '<a href="javascript:void(0)" style="text-transform:capitalize;">'.$palavra.'</a>'.PHP_EOL;
}
}
}
expected result
$ep = ['adeus-longos-dias','entranhas','diga-isso-ao-sapos']...
Separate by commas within a comma array? How would that be? Could you put the result you hope to obtain?
– Woss
@Andersoncarloswoss I edited the question with what I hope to do
– goio
Split:
$nomeEpisodio
has the name of only one episode or all? If it is of only one, is that part inside a loop of repetition? If yes, it should be in the question too. By the image, the names of the episodes are in running text, as "Goodbye Long Days", but the expected result is "goodbye-long-days". Will this conversion need to be done or did you misplace it somewhere? It could also be part of the question.– Woss
@Andersoncarloswoss I managed, it was only lack of attention, I only changed the variables
$nomeEpisodio
for$slugEpisodios
– goio
GROUP_CONCAT
would not solve?– Miguel Silva