PostgreSQL - lose new line characters

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
reubenolson
Forum Newbie
Posts: 2
Joined: Sat Jul 27, 2002 6:01 am

PostgreSQL - lose new line characters

Post 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
lc
Forum Contributor
Posts: 188
Joined: Tue Apr 23, 2002 6:45 pm
Location: Netherlands

Post 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. ;)
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

reubenolson
Forum Newbie
Posts: 2
Joined: Sat Jul 27, 2002 6:01 am

Thanks

Post by reubenolson »

THanks heaps aye workeed just rite

:lol: :D :lol:
Post Reply