RE: [PHP] Formatting text
| From: | John W. Holmes | Date: | Sun, 29 Dec 2002 18:16:52 +0000 |
| Subject: | RE: [PHP] Formatting text | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-129593@lists.php.net to get a copy of this message | ||
> Please note that the following is my code :
> Quote :
>
> if ($result=mysql_query($sql)) {
> $numofrows=mysql_num_rows($result);
> Print "Greengrass database has found the following result that
> matches
> your search";
> print " <br>\n";
> print " <br>\n";
> while($row=mysql_fetch_array($result)){
> Print " Identity : ".$row[GGID]."<br>\n"." ";
> Print " Organisation name : ".$row[OrgName]." <br>\n"."";
> Print " Organisation country : ".$row[OrgCountry]."
> <br>\n"."";
> Print " Organisation Address : ".$row[OrgAddress]."<br>\n"."
> ";
> Print " Results : ".$row[Results]."<br>\n";
> print " <br>\n";
> print " <br>\n";
> }
>
> Unquote.
>
> In the above code, I want to format the text in only one field and
that is
> the field named "Results".
> Where do I put the <PRE> </PRE> tags for formatting the text contained
in
> the mysql field "Results"?
How about around $row[Results]?
print " Results :
<pre>".$row['Results']."</pre><br>\n";
Note the addition of the single quotes, which you should get in the
habit of using (so you don't get Undefined Constant errors on a machine
with a stricter error_reporting() level).
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/