Page 1 of 1

PostgreSQL - lose new line characters

Posted: Sat Jul 27, 2002 6:01 am
by reubenolson
When I am getting a varchar from the database I do not get the new lines all the text just comes out as one block of text. Howcan I get the data out of the database with the newline characters still intake. I can tell the newline characters are in the database so how can I get the data out with those newline characters intake. I use the following code to get the data out of the database:

$result=pg_exec($db, "SELECT * FROM Jobs WHERE JobID = $JID;");
$row = pg_fetch_row($result, 0);
$Jpo=$row[0];
$Jch=$row[1];
$Jdm=$row[2];
$Jad=$row[3];
$Jci=$row[4];
$Jst=$row[5];
$Jzp=$row[6];
$Jco=$row[7];
$Jph=$row[8];
$Jem=$row[9];
$Jur=$row[10];
$Jcn=$row[11];
$Jjd=$row[12];


Thanks for your help

Reubs

Posted: Sat Jul 27, 2002 8:28 am
by lc
I don't know exactly what you are doing and have no experience with sql of any kind but how about replacing the newlines with <br> before entering the data in your database... that should do it.

like:

$data = ereg_replace("\r\n", "<br>", $data);

kindof. ;)

Posted: Sat Jul 27, 2002 8:49 am
by hob_goblin

Thanks

Posted: Sat Jul 27, 2002 6:07 pm
by reubenolson
THanks heaps aye workeed just rite

:lol: :D :lol: