csgcarl Posted June 24, 2007 Share Posted June 24, 2007 Hello there, Ok I know you can get info from db by doing $member[logo]... but say I wanted to get info from another db e.g. on website I want to get info from the forum db, but the site already has a db... so when I put $member[logo] on site it gets it from site how do I make it fetch the info from the forum$member[logo]. If you undertand what I mean, I have had alook around but not 100% sure on how it's done. Regards, Carl Quote Link to comment https://forums.phpfreaks.com/topic/56949-solved-how-to-fetch-info-from-db/ Share on other sites More sharing options...
.Stealth Posted June 24, 2007 Share Posted June 24, 2007 It depends how you want to do it. Your question is very vague. Instead of connecting to the database for "site" connect to the forum database. Maybe you could explain more, do you want to get info from 2 databases in the same script? Quote Link to comment https://forums.phpfreaks.com/topic/56949-solved-how-to-fetch-info-from-db/#findComment-281306 Share on other sites More sharing options...
csgcarl Posted June 24, 2007 Author Share Posted June 24, 2007 Ye basicly what I'm going to do is have an online form(site)... and the users field will need to get the info from the forum db instead of the site db... so ye 2 databases in the same script. I hope that explains it more, hehe I know what I need to do but not sure how:( Thanks for your reply Stealth. Carl Quote Link to comment https://forums.phpfreaks.com/topic/56949-solved-how-to-fetch-info-from-db/#findComment-281310 Share on other sites More sharing options...
.Stealth Posted June 24, 2007 Share Posted June 24, 2007 From what you are saying you only need to connect to the forum database. Sorry if I'm misunderstanding you but do you know how to connect to a database? mysql_connect(host,username,password); mysql_select_db(database_name); Quote Link to comment https://forums.phpfreaks.com/topic/56949-solved-how-to-fetch-info-from-db/#findComment-281333 Share on other sites More sharing options...
csgcarl Posted June 24, 2007 Author Share Posted June 24, 2007 so how would I get info from another db field... as say the config file says this: // MYSQL DATABASE INFO $db[host] ='localhost'; $db[uname] ='bseadmin_test'; $db[pass] ='password'; $db[name] ='bseadmin_test'; But if I say enter $member[logo] it will get the info from the above db (bseadmin_test) but if I wanted to get some of the members info from another db say $member[picture] (bseadmin_test1) how could I do this? Quote Link to comment https://forums.phpfreaks.com/topic/56949-solved-how-to-fetch-info-from-db/#findComment-281448 Share on other sites More sharing options...
fenway Posted June 27, 2007 Share Posted June 27, 2007 You'd have to issue both queries separately and switch dbs in between, unless you happen to use the same credentials for both. Quote Link to comment https://forums.phpfreaks.com/topic/56949-solved-how-to-fetch-info-from-db/#findComment-284294 Share on other sites More sharing options...
csgcarl Posted June 28, 2007 Author Share Posted June 28, 2007 Hello fenway, thanks for your reply. Could you/some one explain this abit more as I'm not to sure what you mean, I have never done this before so it's new to me. Thanks alot. Carl Quote Link to comment https://forums.phpfreaks.com/topic/56949-solved-how-to-fetch-info-from-db/#findComment-285238 Share on other sites More sharing options...
fenway Posted June 29, 2007 Share Posted June 29, 2007 Just issue two seperate queries, and use mysql_select_db() to switch the DB in between -- you've already established 2 separate db connections at this point. Quote Link to comment https://forums.phpfreaks.com/topic/56949-solved-how-to-fetch-info-from-db/#findComment-285753 Share on other sites More sharing options...
csgcarl Posted June 30, 2007 Author Share Posted June 30, 2007 Ah gotya thanks alot for claring that up:) Quote Link to comment https://forums.phpfreaks.com/topic/56949-solved-how-to-fetch-info-from-db/#findComment-286681 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.