In the field newsarticle i have the whole article, I need php to somehow
know when to format the article with
linebreaks, paragraphs, links etc...
If I add small pieces of HTML code in the article when I add it to the table
field, how do I make php know that when
it find these html codes it should write them out to the document. Just to
make a nice structure to the document. ;)
I hope somebody understands me ;) I'm pretty fresh
Kjetil Brekke
--
Med Vennlig Hilsen,
Kjetil Brekke
Konsulent
Telenor Internett Kundeservice
www.online.no/hjelp
If you keep the entire article in the database it doesn't make it very easy
to edit the thing, and it opens avenues for your readers to go directly to
the article (if you have it accessable outside your script).
If you include HTML in the txt file PHP should include that in the output to
the browser thus preserving the format.
If that is not acceptable, you will have to devise some sort of method to
"encode" your data format and a way to "decode" it.
--
Sean S.
sunymoon >at< geocities <dot> com
Hex(RGB) -> http://thedoh.dyndns.org/hexrgb/index.php
"Kjetil Brekke" <cab...@cabsternet.com> wrote in message
news:bNYK6.8852$gX3.6...@news3.oke.nextra.no...
The body of the article is stored in MySQL as type TEXT. I use
AddSlashes() before I store the HTML in the database, and when I get the
record, the HTML automagically pops out correctly.
So, when storing the article "body", I use:
$myquery = "INSERT INTO article VALUES ($article_id,
$menu_id,
'$title',
'$subtitle',
'$blurb',
$author_id,
'$copyright',
'$issue',
'$excerpt',
'$body',
0,
0,
" . time() . ")";
and when I retrieve, I use:
$myrow = mysql_fetch_array($result);
echo $myrow[body] . "\n";
It works!
Oh, and storing the text in the database makes it incredibly easy to
implement a simple search:
$sql = "SELECT * FROM article WHERE body like '%$searchterm%'
ORDER BY article_id";
This is the primary reason I use a database instead of external files as
someone else suggested.
I hope this helps! Good luck!
Dave
cab...@cabsternet.com (Kjetil Brekke) wrote in
<bNYK6.8852$gX3.6...@news3.oke.nextra.no>: