insert line break / carriage return at end of php string
Posted: Fri Jan 20, 2012 4:40 pm
i have this code:
the string comes out looking like this:
Code: Select all
<?php
include("dbinfo.inc.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM ldata";
$result=mysql_query ($query);
$num=mysql_num_rows ($result);
mysql_close();
$i=0;
while ($i < $num) {
$id=mysql_result($result,$i,"id");
$file_id=mysql_result($result,$i,"file_id");
$entity=mysql_result($result,$i,"entity");
$datax = $id . ';' . $file_id . ';' . $entity . '\n';
echo nl2br($datax);
++$i;
}
?>the string comes out looking like this:
but i want it to be like:65;53;Home Office\n13;7;Home Office\n106;90;Home Office\n
not quite sure how to do it.65;53;Home Office
13;7;Home Office
106;90;Home Office