Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old October 31st, 2003, 07:06 PM
mdhall mdhall is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 158 mdhall User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Search multiple tables with one keyword

I have 4 tables in a db. Each contains a category field, however the tables are not connected or linked by these fields, as they hold different types of info. The tables are "bands", "musicians", "songwriters", & "otherposts".
If possible, I'd like to use one search page & query to query all 4 tables at once, by category. So on a search page, the user can select Bands, Musicians, Songwriters, or Other, then hit the submit/search button. The query would then bring up all the db entries that match the category the user chose. I've tried a few queries but get no results. I didn't think this would be considered a join, since the tables are basically unrelated and I dont need info from all the tables at one time.
My basic form...

<form action=search.php method=post>
<input type=radio name=search_cat value=bands>Bands<br>
<input type=radio name=search_cat value=musicians>Musicians<br>
<input type=radio name=search_cat value=songwriters>Songwriters<br>
<input type=radio name=search_cat value=other>Other

And the query I tried...

$query=("SELECT * FROM bands.category,musicians.category,songriters.categ ory,otherposts.category WHERE category LIKE '$search_cat'");

I also tried a few variations on this, and I'm probably way off base.

Reply With Quote
  #2  
Old October 31st, 2003, 08:00 PM
zombie zombie is offline
Codewalkers Intermediate (1500 - 1999 posts)
 
Join Date: Apr 2007
Location: serbia
Posts: 1,876 zombie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: Search multiple tables with one keyword

you can't do that.

use 4 different queryes.

Reply With Quote
  #3  
Old October 31st, 2003, 08:08 PM
mdhall mdhall is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 158 mdhall User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Search multiple tables with one keyword

OK, i had a feeling thats what I would have to do. Thnx

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Search multiple tables with one keyword


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway