Mário Correia Mário Correia - 6 months ago 13
PHP Question

Show names separated (Getting names from database)

In my database I have one column named

name
and in each row of that column I'm saving names like this
/Mary/Sam/Bob/Michael/
. To show the values in my page I need to separate them by breaking the line in each
/
. Can someone help me?

If I make one echo of my column I will get
/Mary/Sam/Bob/Michael/
but I want:

Mary
Sam
Bob
Michael

Answer
$names=explode('/', $dbrow['name']);
foreach($names as $aname){
  echo $aname.'<br>';
}