database for books question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I'm designing a PHP/MySQL site to manage a collection of books. I have so
far created the table and inserted some of the data, and created a web
interface to access that data. I have a couple of things I'd like to do
though, if anyone has ideas.

Firstly, I want to do subject searches. For example, let's say we have two
books. For each book there is a field named "subjects". That field contains
space-delimited subject names. For example, the first book might say
"Nonfiction PHP Technology Computers Programming" and the second book might
say "Nonfiction Technology History Linux".

Now I want to be able to do a subject listing as well as a search. For
example, if I asked for a lsit of all subjects, I want something like:
Nonfiction (2)
PHP (1)
Technology (2)
Computers (1)
Programming (1)
History (1)
Linux (1)

Can this be done simply by using MySQL queries and PHP functions or will
there need to be a constantly updated SQL table of these subject keywords?

Also when I am performing searches via subject, can I do "token" searches?
Like if I search for "fiction" books the query might look like "select
book_id from library where subjects like '%fiction%'" - Only problem with
that, is it would also pick up "nonfiction" since the word fiction is still
a wildcard match.

I'm also tryin to figure out the best way to do searches. Right now I have a
simple search that simply does "select book_id from library where title like
"%{whatever the user entered}%" or author like "%{whatever the user
entered]%"". This works for basic simple searching, but I'd like to
implement advanced searches.

THanks for any advice.
Flint M

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux