Is it possible to display the data of a table separately?

Asked

Viewed 37 times

0

I have a table in my database and it contains a column with the following data:

link.com/1, link.com/2, link.com/3, link.com/4

What I would like to know is if there is a way I can query in PHP and return the value of the column where each value only comes to , one line and the other line:

link.com/1

link.com/2

link.com/3

link.com/4

Is there any chance of doing it that way?

1 answer

0

You can split the string by comma, so use the function explode:

<?php

$retorno_bd = "link.com/1, link.com/2, link.com/3, link.com/4";

// converte a string em um array
// utiliza a "," para fazer a divisao
$array = explode( ",", $retorno_bd);


foreach($array as $linha){
    echo "$linha \n";
}

?>

View the code in Ideone

Browser other questions tagged

You are not signed in. Login or sign up in order to post.