| | |
SQL search query
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2006
Posts: 7
Reputation:
Solved Threads: 0
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.
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.
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
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
•
•
Join Date: Mar 2006
Posts: 7
Reputation:
Solved Threads: 0
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.
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.
•
•
•
•
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?
.
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.
•
•
Join Date: Mar 2006
Posts: 7
Reputation:
Solved Threads: 0
•
•
•
•
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.
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.
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.
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.
•
•
Join Date: Mar 2006
Posts: 7
Reputation:
Solved Threads: 0
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.
Thanks for the help so far, I appreciate it. By the way, my site is in php if that helps.
Justin.
•
•
Join Date: Mar 2006
Posts: 7
Reputation:
Solved Threads: 0
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.
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.
![]() |
Other Threads in the PHP Forum
- Previous Thread: class_http could not open message
- Next Thread: Submit info to database error
Views: 9077 | Replies: 14
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class clean cms code countingeverycharactersfromastring crack cron curl database date directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail match menu methods mlm mod_rewrite multiple mysql oop parse paypal pdf php problem query radio random recursion regex remote script search select server sessions simple sms soap source space spam speed sql structure syntax system table tutorial update updates upload url validation validator variable video web xml youtube






