Hi i have a textarea box that user enters list of names what i've been trying to do is when retriving the data from the database the specific row .$row["name_drivers"]. when display back the data evrytime it finds a coma in that field replaces with a line break e.g gary nevile, steven gerard, michael tyson, david ginola instead of displaying like this displays like above gary nevile steven gerard michael tyson david ginola i have tried $name_drivers = str_replace(",", "\n", $name_drivers); but no luck is it possible to achive somthing what i am trying to do here my whole code [PHP]$name_drivers = str_replace(",", "<br>", $name_drivers); $id = $_GET['c']; $drivers = mysql_query("SELECT name, date_of_birth, start_time, number_drivers, name_drivers, last_update, display, DATE_FORMAT(date_of_birth, '%a %D %b %Y') as new_date, DATE_FORMAT(last_update, '%a %D %b %Y') as new_update, DATE_FORMAT(start_time, '%H:%i') as timing FROM event WHERE id='$id' "); while ($row = mysql_fetch_assoc($drivers)) { if(isset($row['display']) && $row['display'] == "1") { echo "<p><strong>Track:</strong> ".$row["name"]."</p>"; echo "<p><strong>Track:</strong> ".$row["name"]."</p>"; echo "<p><strong>Date:</strong> ".$row["new_date"]."</p>"; echo "<p><strong>Start Time:</strong> ".$row["timing"]."am</p>"; echo "<p><strong>Number of drivers booked in:</strong> ".$row["number_drivers"]."</p>"; echo "<p><strong>Last Update:</strong> ".$row["new_update"]."</p>"; echo "<p><strong>List of drivers booked in:</strong> ".$row["name_drivers"]."</p>"; } PHP: but i get the following
Hi i found a solution in case anyone might needed in the future i replace this line of code echo "<p><strong>List of drivers booked in:</strong> ".$row["name_drivers"]."</p>"; PHP: With this one echo "<p><strong>List of drivers booked in:</strong> ".str_replace(',','<br />',$row["name_drivers"])."</p>"; PHP: