SQL search query

Reply

Join Date: Mar 2006
Posts: 7
Reputation: Broomy is an unknown quantity at this point 
Solved Threads: 0
Broomy Broomy is offline Offline
Newbie Poster

SQL search query

 
0
  #1
Mar 31st, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 1,181
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Solved Threads: 67
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: SQL search query

 
0
  #2
Mar 31st, 2006
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
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 7
Reputation: Broomy is an unknown quantity at this point 
Solved Threads: 0
Broomy Broomy is offline Offline
Newbie Poster

Re: SQL search query

 
0
  #3
Mar 31st, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 1,181
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Solved Threads: 67
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: SQL search query

 
0
  #4
Mar 31st, 2006
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.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 7
Reputation: Broomy is an unknown quantity at this point 
Solved Threads: 0
Broomy Broomy is offline Offline
Newbie Poster

Re: SQL search query

 
0
  #5
Mar 31st, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 802
Reputation: Phaelax is on a distinguished road 
Solved Threads: 40
Phaelax Phaelax is offline Offline
Practically a Posting Shark

Re: SQL search query

 
0
  #6
Apr 1st, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 1,181
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Solved Threads: 67
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: SQL search query

 
0
  #7
Apr 1st, 2006
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.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 7
Reputation: Broomy is an unknown quantity at this point 
Solved Threads: 0
Broomy Broomy is offline Offline
Newbie Poster

Re: SQL search query

 
0
  #8
Apr 2nd, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 7
Reputation: Broomy is an unknown quantity at this point 
Solved Threads: 0
Broomy Broomy is offline Offline
Newbie Poster

Re: SQL search query

 
0
  #9
Apr 4th, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 1,181
Reputation: hollystyles will become famous soon enough hollystyles will become famous soon enough 
Solved Threads: 67
hollystyles's Avatar
hollystyles hollystyles is offline Offline
Veteran Poster

Re: SQL search query

 
0
  #10
Apr 4th, 2006
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.
==========================================
Yadda yadda yadda...
Web junky, fevered monkey
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum


Views: 9077 | Replies: 14
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC