By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,664 Members | 1,669 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,664 IT Pros & Developers. It's quick & easy.

Storing article text in a database

P: n/a
I have a website with an increasing amount of articles and news reports and
so I am thinking of moving away from storing each article as a seperate page
to having a single page and storing articles in a databasewhich are
retrieved using a GET parameter.

I see the advantage to me in using this approach as being making use of
MySQL's fulltext search capability and less work needed when updating the
design of the page. I'm not sure of a few things though:

1. The exact benefits of fulltext. Can someone provide a brief explanation
or a good website

2. I imagine that storing just the plain text of the article in the database
will result in a single block paragraph when retrieved into the page. Do I
need to include the HTML markup with the text in the database or is there a
different approach?

3. Will the HTML markup in the article interfere with the ability to search
for words i.e. if I have a word "recipes" in an article that is surrounded
tags like <b>recipes</b>, will a search on this article pick out the word
from in between the tags?

Thanks.
Mark
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I noticed that Message-ID: <kJ******************@doctor.cableinet.net>
from Mark contained the following:
1. The exact benefits of fulltext. Can someone provide a brief explanation
or a good website
Not sure what you mean by 'fulltext'?
2. I imagine that storing just the plain text of the article in the database
will result in a single block paragraph when retrieved into the page. Do I
need to include the HTML markup with the text in the database or is there a
different approach?
See http://uk.php.net/nl2br
3. Will the HTML markup in the article interfere with the ability to search
for words i.e. if I have a word "recipes" in an article that is surrounded
tags like <b>recipes</b>, will a search on this article pick out the word
from in between the tags?


If you include wildcards you can search for words or parts of words
e.g. SELECT * FROM table WHERE fieldname LIKE%searchterm%;
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #2

P: n/a
"Geoff Berrow" <bl******@ckdog.co.uk> wrote in message
news:hv********************************@4ax.com...
I noticed that Message-ID: <kJ******************@doctor.cableinet.net>
from Mark contained the following:
1. The exact benefits of fulltext. Can someone provide a brief explanationor a good website


Not sure what you mean by 'fulltext'?


http://dev.mysql.com/doc/mysql/en/Fulltext_Search.html

Seaching for fish will match fishing, fished, fishes and is therefore more
"natural" and powerful.
2. I imagine that storing just the plain text of the article in the databasewill result in a single block paragraph when retrieved into the page. Do Ineed to include the HTML markup with the text in the database or is there adifferent approach?
I suggest that you follow the bb code scheme from various message board
applications like phpbb, vbulletin and IPB.

The idea is that instead of html markup you have your own quasi-markup and
you can then parse the text more efficiently to ensure the user is not upto
naughty shanigans like inserting links to porn sites.

so <b> becomes [b] etc
3. Will the HTML markup in the article interfere with the ability to searchfor words i.e. if I have a word "recipes" in an article that is surroundedtags like <b>recipes</b>, will a search on this article pick out the word
from in between the tags?


Yes, but see about on why you shouldn't allow html mark in your data.

Jul 17 '05 #3

P: n/a

"CJ Llewellyn" <sa****@tmslifeline.com> wrote in message
news:cb**********@slavica.ukpost.com...
"Geoff Berrow" <bl******@ckdog.co.uk> wrote in message
news:hv********************************@4ax.com...
I noticed that Message-ID: <kJ******************@doctor.cableinet.net>
from Mark contained the following:
1. The exact benefits of fulltext. Can someone provide a brief explanationor a good website
Not sure what you mean by 'fulltext'?


http://dev.mysql.com/doc/mysql/en/Fulltext_Search.html

Seaching for fish will match fishing, fished, fishes and is therefore more
"natural" and powerful.


Thanks. I've read this - I was also wondering if there were any negative
aspects of using fulltext searching or any benefits in using a different
approach. Someone suggested just using a third party search engine but I'd
rather keep everything in-house - it just looks more professional.
2. I imagine that storing just the plain text of the article in the databasewill result in a single block paragraph when retrieved into the page. Do
I
need to include the HTML markup with the text in the database or is
there
adifferent approach?
I suggest that you follow the bb code scheme from various message board
applications like phpbb, vbulletin and IPB.

I'm not sure why you suggest this as I'm not building a bbs.
The idea is that instead of html markup you have your own quasi-markup and
you can then parse the text more efficiently to ensure the user is not upto naughty shanigans like inserting links to porn sites.

Can you elaborate a but more on why you say this? It sounds very bad and
porn would not be good for my site but I'm not sure how this is relevant to
my site which contains mostly articles written by a few people and uploaded
by me - I have no users posting on my site.
so <b> becomes [b] etc
3. Will the HTML markup in the article interfere with the ability to searchfor words i.e. if I have a word "recipes" in an article that is surroundedtags like <b>recipes</b>, will a search on this article pick out the

wordfrom in between the tags?


Yes, but see about on why you shouldn't allow html mark in your data.


See where? Is there something wrong with using html markup in my data? I'm
just only using markup to separate paragraphs and for image links. I was
wondering if this was the only way to do it if you wanted to store article
data in a database that you don't want to come out as a big block of text
(or is there a way of adding markup after retrieving the text data?). The
downside I see is just editing the text in phpAdmin instead of Dreamweaver
if I want to make an update to articles. Just want to make sure I am abreast
of all potential issues before changing the way I do things. Knowledge &
suggestions from experienced php developers is helpful.

Thanks
Mark
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.