Hi guys,

I'm trying to take a csv from mySQL DB and have it display in an html table with line breaks instead of the csv format. In the below example, the variable "Flag" is a csv format, so it shows up in the html table like so:(company1, company2, company3). I would like it to be displayed in the html table like this: (company1<br>company2<br>company3<br>) ...if you catch my drift.

I'm calling it like so:

while($row = mysql_fetch_array($result)){

echo "<td>" . $row['Flag'] . "</td>";}

Any ideas?

Member Avatar for diafol

Like this?

while($row = mysql_fetch_array($result)){
    echo "<td>" . str_replace(',','<br />',$row['Flag']) . "</td>";
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.