I have the following data list of a WHILE
in PHP
<?php
$query = "SELECT * FROM table where value='$thisvalue'";
$result = mysqli_query($conexion, $query);
while ($row = mysqli_fetch_assoc($result)) {
$campo = $row['value'];
//QUITAR PALABRAS SI ENCUENTRA UN - SOLO PALABRAS.
echo $campo;
}
PANELEGP00001
PANELEGP00003
PANELEGP00001-1
PANELEGP00002-TOS
PANELEGP00004-2
LIVOR-44_900_2100
I wish I could remove the words ONLY THE WORDS when I found a - . I've been looking for methods in PHP try with str_replace
but I have not had results.
I would like a result like that.
PANELEGP00001
PANELEGP00003
PANELEGP00001-1
PANELEGP00002 //SE QUITO LA PALABRA TOS
PANELEGP00004-2
LIVOR-44_900_2100