Go Back   Webmaster Malaysia Forum » Website Design & Development » Website Programming

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 17-09-2004, 09:44 AM
Novice Webmaster
 
Join Date: Sep 2004
Location: Shah Alam
Posts: 68
Rep Power: 50
infeeneetee is on a distinguished road
Question mysql: join table antara 2 databases?

haloo

soalannya begini..

1: bole ke kita join 2 atau lebih tables antara 2 mysql databases dalam php?

contoh nya satu database untuk 'forum' dan satu lagi database utk 'article'...

atau

2: connect 2 mysql databases dalam masa dan page yang sama ..
adakah akan terjadinya error?..

dan

3: apa advantage and disadvantage antara kedua-dua di atas?
dan minta cadangan korang kalau ada cara yang lebih baik lagi..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 17-09-2004, 11:30 AM
Gemp-X's Avatar
Novice Webmaster
 
Join Date: Apr 2002
Location: kuantan, pahang
Posts: 58
Rep Power: 79
Gemp-X is on a distinguished road
Send a message via Yahoo to Gemp-X
Bole

1) SELECT * FROM database1.table1, database2.table2 WHERE table1.id=table2.id

2) tak

3) tak tau, hehehe. sape lagi berpengetahuan bagitau la
__________________
http://sidik.org/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 17-09-2004, 11:50 AM
Novice Webmaster
 
Join Date: Sep 2004
Location: Shah Alam
Posts: 68
Rep Power: 50
infeeneetee is on a distinguished road
ic.. terima kasih..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 17-09-2004, 02:59 PM
Khairul_Izwan's Avatar
Novice Webmaster
 
Join Date: Nov 2003
Location: Kuala Lumpur
Posts: 28
Rep Power: 0
Khairul_Izwan is on a distinguished road
Wink

raser takder aper2...sebab itu hanya database sajer...tak kisah kalau nak kongsi berapa pun dalam satu page....cam kita kongsi 1 database untuk banyak field ler...i think there will be no error

__________________
" I love you as much as i know how "
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 17-09-2004, 03:00 PM
Khairul_Izwan's Avatar
Novice Webmaster
 
Join Date: Nov 2003
Location: Kuala Lumpur
Posts: 28
Rep Power: 0
Khairul_Izwan is on a distinguished road
ermmm raser takder aper2...sebab just guna lebih database jer...yerlah cam kita guna banyak field untuk satu database...i think there will be now error
__________________
" I love you as much as i know how "
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 19-09-2004, 01:07 PM
Novice Webmaster
 
Join Date: Sep 2004
Location: Shah Alam
Posts: 68
Rep Power: 50
infeeneetee is on a distinguished road
oh.. sebab saya kira kalau nak pakai 2 database kena connect dua dua... so bila kita select table dia jadi pening nak select mana satu hehe.. jadi kalau ada dua table nama yang sama dalam 2 database tak ke dia pilih dua dua?..

camano lak tu?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 21-09-2004, 12:26 PM
Inspired Webmaster
 
Join Date: Jul 2004
Location: SJ, Selangor
Posts: 189
Rep Power: 53
vcheewei is on a distinguished road
okie, i might be able to answer your question.

if you are using php u can connect to both database at the same time in a single script.

You code as usual but when you are about to make a query to database A u do this.

PHP Code:
  mysql_select_db("A"); 
then when you are about to query database B. Just call this method.
PHP Code:
  mysql_select_db("B"); 
then u perform your query to it.
everything should work fine.

Also, take note, u have to connect to the mysql with mysql_connect('','','');

regarding your question 3, both has it advantage and disadvantages. As for first method your query will be definitely longer, while second method will be simplier and easier.
but if you are talking about efficiency then you'll have to test it by using a timer.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 21-09-2004, 04:03 PM
Novice Webmaster
 
Join Date: Sep 2004
Location: Shah Alam
Posts: 68
Rep Power: 50
infeeneetee is on a distinguished road
got it!! .. thanks vcheewei..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 21-09-2004, 07:15 PM
Inspired Webmaster
 
Join Date: Jul 2004
Location: SJ, Selangor
Posts: 189
Rep Power: 53
vcheewei is on a distinguished road
no problem.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mod: Table and cup Tahar Graphic Design 1 06-10-2006 08:40 PM
letak adsense antara forum phpbb Rezats Website Programming 0 28-05-2006 10:29 AM
upload file to mysql table... ginger_nur Website Programming 1 07-06-2005 12:27 PM
Masalah dgn mysql join table nixx Website Programming 3 20-10-2004 01:16 PM
Table? Css? lcf Website Design 10 22-03-2004 09:40 AM



All times are GMT +8. The time now is 07:11 AM. Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.


WebmasterMalaysia.com is Proudly Hosted by Exabytes Semi Dedicated Server.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58