Re: nl2br and BLOB field of MySQL

[email protected] ("Bsantos PHP") Wed, 25 Sep 2002 11:19:36 +0100
Newsgroups php.lang
Message-ID <[email protected]>
bsantos on 2002/09/25:

Two solutions for your problem.
You've got to manage them, anyway.

There's nothing wrong with your code. PHP don't like the what I call:
"direct nameset of variable"; just like

$row[something]

I rather do this:

$new_var = $row[something]

that way, always I use nl2br, all works fine.
Anyway I do not use to put thinks in separated lines, like:

$var  =
$var .=
$var .=

but checked that $var = "<td>nl2br($new_var)</td>"; works much better.

If none of this work, try to checkout if you are not using thinks like this
"<td align="center">"; instead of this: <td align=\"center\">";

or try to make a function { $nl_var = nl2br(something) };

bsantos
Webmaster MFi

"Jorge Pinto Leite" <[email protected]> wrote in message
news:[email protected]...
> It's probably a problem of my code, can anyone help me?
> I have a BLOB field in a MySQL table. This field is filled in a php page
> with a <textarea>, where I can enter it formatted, with ENTER's to split
> some lines from others.
> In another page, this field is seen (not updated) - so I don't have a
> <textarea> tag.
> As I want to see the text exactly as entered, I have put the following
code:
> $res="<td><font...";
> $res.=nl2br($row[blobfield]);
> $res.="</font></td>";
> echo ($res);
> and the result is that I cannot see any part of the blob field.
> If I change my code to
> $res="<td><font...";
> $res.=$row[blobfield];
> $res.="</font></td>";
> echo ($res);
> the complete blob field is seen, yet unformatted.
> What am I doing wrong?
> Thanks,
> Jorge
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.384 / Virus Database: 216 - Release Date: 21-08-2002
>
>