944,073 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 12599
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
Mar 31st, 2006
0

SQL search query

Expand Post »
Hi, i'm very new to sql so to say i'm a bit confused is a bit of an understatement! I'm tring to set up a search facility so that results from multiple databases will come from just one form. A better way of explaining would be to show an example of a site that does just what i'm after - buzzle.com. When a search is performed the results are split into different sections. On my site this would be for example "articles", "ebooks" and "links".

My question is how can I go about setting up a form and the search so that it would query the different databases and display just like the site i've provided above, with the different result "sections" on the same results page?

I hope you can help,
Thanks in advance,
Justin.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Broomy is offline Offline
7 posts
since Mar 2006
Mar 31st, 2006
0

Re: SQL search query

Hmmm.. this is not a small question.

There are various methods of collating results from more than one database depending on the databases in question, are they all the same for example (MS SQLserver or Oracle ir MySQL) and are they on the same server or spread all over, in one domain or several.

I suspect buzzle.com has one database in which each entry has a type atribute (chapter, article or link)

example:

----------------------------------------------------------------------------------------------------
| Table: Content |
========================================================
|ID |Type |Keywords |URL |
========================================================
|1 |Chapter |buzz buzzle |http://buzzle.com |
|2 |Article |buzz buzzle |http://buzzle.com/articles/buzzle.asp |
|3 |Link |buzz buzzle |http://buzzle.com/links/index.asp?id=1234 |
========================================================

The SQL query to retreive the data:

SELECT * FROM content WHERE keywords LIKE '%buzzle%' ORDER BY type
Reputation Points: 262
Solved Threads: 68
Veteran Poster
hollystyles is offline Offline
1,181 posts
since Feb 2005
Mar 31st, 2006
0

Re: SQL search query

The database I have at the moment is MySQL, and the other two that I want to add (I haven't yet but want to try and set up the search to make sure I can get things working before) will also be MySQL, all installed on the same server.

Not being a small question, does that mean that this may be too difficult for a newbie (me!) to be talked through to accomplish? I hope not as i really want this to work.

Hope you can help,
Thanks for the reply,
Justin.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Broomy is offline Offline
7 posts
since Mar 2006
Mar 31st, 2006
0

Re: SQL search query

Quote originally posted by Broomy ...
Not being a small question, does that mean that this may be too difficult for a newbie (me!) to be talked through to accomplish?
.
Well we are all newbies at some point. I must say for a newb your project does sound ambitious, but don't let that put you off. The key is to break it down into managable chunks. My first concern is why you feel the need to store this data in three seperate databases? instead of all together in one.

How familiar are the terms: relational data; normalisation; set theory; to you? Have you heard of a guy called F Codd ?

Your answers will help me to establish what stage you are at so I can point you in the right direction.
Reputation Points: 262
Solved Threads: 68
Veteran Poster
hollystyles is offline Offline
1,181 posts
since Feb 2005
Mar 31st, 2006
0

Re: SQL search query

Quote originally posted by hollystyles ...
How familiar are the terms: relational data; normalisation; set theory; to you? Have you heard of a guy called F Codd ?

Your answers will help me to establish what stage you are at so I can point you in the right direction.
Unfortunately i'm not familiar with any of those terms, and the only think i know about F Codd is what i've just read after a quick search!

The only reason i was going to use three seperate databases was purely due to instructions that usually mention creating a database for them. For example, the link script which i would like to add to my site which will then include the links added in the search i'm trying to add, will have a MySQL database. I usually stick to the instructions i'm given to stop myself from messing anything up, but i guess there's no reason i couldn't add the tables into one database if it would be easier and if there is no problem doing that.

Justin.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Broomy is offline Offline
7 posts
since Mar 2006
Apr 1st, 2006
0

Re: SQL search query

Quote ...
I suspect buzzle.com has one database in which each entry has a type atribute (chapter, article or link)
I thought the same thing. Alternatively though, you could connect to each database separately and perform the same query.
Reputation Points: 92
Solved Threads: 51
Practically a Posting Shark
Phaelax is offline Offline
856 posts
since Mar 2004
Apr 1st, 2006
0

Re: SQL search query

OK Justin,

Can we have a look at this link script then please?

Is your site online yet ? what's the URL?

Like Phaelax says if you have incorporated several add-on databases to your site it is possible to query each one and concatenate the results for display as one list split by catagory.

How depends on what you have, is your site using PHP ? or ASP for example.
Reputation Points: 262
Solved Threads: 68
Veteran Poster
hollystyles is offline Offline
1,181 posts
since Feb 2005
Apr 2nd, 2006
0

Re: SQL search query

I haven't actually installed the link script yet, but I was checking that what i wanted doing could actually be done, and thought if i could work out how to do it then i could confugure the search facility as soon as I added the link script. It might be best if i install the link directory script first, and then re-open this thread, so that I can try to work through any instructions properly rather than struggle through any example instructions, as i'll probably get easily confused otherwise :o .

Thanks for the help so far, I appreciate it. By the way, my site is in php if that helps.

Justin.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Broomy is offline Offline
7 posts
since Mar 2006
Apr 4th, 2006
0

Re: SQL search query

Would you recommend that I install the link script as a seperate database or shall I use my existing database when installing the script, as the install instructions just asks for the database name, password url.

I'm just wondering whether this would cause any problems, eg. could any tables be overwritten doing it this way? I'm just guessing, but wanted to find this out before I go ahead and install it.

Thanks for your help,
Justin.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Broomy is offline Offline
7 posts
since Mar 2006
Apr 4th, 2006
0

Re: SQL search query

Can you divulge what script/package you are proposing to use, so I can look at the instructions myself. I can't tell you unless I know what database you have already and what exactly it is your want to install.
Reputation Points: 262
Solved Threads: 68
Veteran Poster
hollystyles is offline Offline
1,181 posts
since Feb 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: class_http could not open message
Next Thread in PHP Forum Timeline: Submit info to database error





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC