GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 30-May-2004, 08:45
misunderstood misunderstood is offline
Member
 
Join Date: Jun 2003
Posts: 121
misunderstood is on a distinguished road

Multiple Database search


I would like to search multiple databases that have different passwords etc. Is there a way that I can search different databases and have the results ordered together? I suspect it can be done but I am unsure of how.
  #2  
Old 30-May-2004, 17:47
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Oh wow! What a strange idea! Did you consider doing the queries for each, storing the results in a temp table? It does sound convoluted just writing this suggestion down!
  #3  
Old 30-May-2004, 17:55
misunderstood misunderstood is offline
Member
 
Join Date: Jun 2003
Posts: 121
misunderstood is on a distinguished road
The reason I ask is that each sub domain will have a site and database with the same tables in. Each will display the relevant data from their database on their sub domain. What I also want to do is display all the contents from all the databases as if it was one site. Confusing I know but ideal if I/someone can work it out.
  #4  
Old 30-May-2004, 18:00
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Have you considered just using ONE table and adding a subdomain_id column to allow access to each sub domain to just their records?
  #5  
Old 30-May-2004, 18:09
misunderstood misunderstood is offline
Member
 
Join Date: Jun 2003
Posts: 121
misunderstood is on a distinguished road
Well to be honest the way my databases are set on my server I can access across domains which is what I will actually be doing. What I have thought is that when the entries are added they submit to 2 databases (their own plus my central database) but this will involve more work in changing the admin sections of my script which is pretty time consuming. :-(
  #6  
Old 31-May-2004, 17:04
misunderstood misunderstood is offline
Member
 
Join Date: Jun 2003
Posts: 121
misunderstood is on a distinguished road
I have now managed to connect to 2 databases with the same pass but I am struggling to UNION the results. I am getting close but just failing at the last step. My code is :
Quote:
$result=mysql_query("SELECT * FROM $listings,$db
UNION ALL
SELECT * FROM $listings,$db2") ;
// got result now count the rows HERE so its not repeated within loop!!

$row = @mysql_fetch_row($result);
if (!$row) {
die('Could not fetch row, reason: '.mysql_error());
}


and the error is :
Quote:
Could not fetch row, reason: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '1 UNION ALL SELECT * FROM listings,1' at line 1


Anybody any ideas where I am going wrong?
  #7  
Old 31-May-2004, 17:52
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Wow, yeah UNION! It's been a while since I last used a "union", but what are those ",$db" and ",$db2" stuff?
  #8  
Old 31-May-2004, 18:23
misunderstood misunderstood is offline
Member
 
Join Date: Jun 2003
Posts: 121
misunderstood is on a distinguished road
Quote:
Originally Posted by JdS
Wow, yeah UNION! It's been a while since I last used a "union", but what are those ",$db" and ",$db2" stuff?
Those are my connections to the database 1 and database 2. In fact I should check that they work individually first

Nope that doesnt seem to work. I think the connection is ok but the actual query is incorrect.
  #9  
Old 01-Jun-2004, 00:59
misunderstood misunderstood is offline
Member
 
Join Date: Jun 2003
Posts: 121
misunderstood is on a distinguished road
I think I may have to change tact on this one
What is the maximum tables a database can hold?
The way I plan to set this up means approx 400-500 tables with about 10 rows in each (searched at smaller intervals) and 1 table with about 10,000 rows (searched at a very high rate). Is this feasable, impossible or just another stupid idea?
  #10  
Old 01-Jun-2004, 07:16
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Quote:
What is the maximum tables a database can hold?
Never got the answer to that one, but supposedly nothing you or I can can throw into a single DB is too much for it to handle.

Anyway, I was asking about the commas in my last reply, why are they there?
 
 

Recent GIDBlogAccepted for Ph.D. program by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Read a .html file, check that file for links salemite C Programming Language 10 17-Jan-2008 08:56
weird search problem!! JUNK KED Open Discussion Forum 3 11-Oct-2003 01:48
How a search engine really works (In english) jrobbio Open Discussion Forum 0 06-Jul-2003 18:13
Search Engine Positioning 101 and 201 "How To" Tips... 000 Search Engine Optimization Forum 0 29-May-2003 11:34
[class] 404 search function code jrobbio MySQL / PHP Forum 6 22-Apr-2003 10:32

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 18:03.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.