Retrieve info from another database
I have two sites with one database each and I would like to retrieve some information from the second database on the other website. Since I cannot connect to two databases, I was thinking of making a php file that prints the info I need and then connect to that file, but will this work?, is it good practice ? and/or are there any better ways to do this ?
Who says you can't connect to 2 databases?
I tried once and got a lot of errors. I mean having two connections on the same page.
Please post the code you used to connect and I'll help ya out.
You could also connect with a seperate file and include it in the page. Heck you could connect and grab all the info and output it inanother file and then include it in your page
I havent coded anything yet, I'll try do something now and get back to this topic when I have some errors to report
I just made a query where I choose the last 5 users registered from the other database and included the file in my first website and I got this error:
mysql error: Table 'usr_br.news_module' doesn't exist
Looks like the "new" query to the other database interferes with my first db connection because the correct table name would be "news_module" the usr_br is just the second database name..
post - your - code
You probably have a simple error in your SQL query but you're really making this process of helping you a lot longer than it has to be by not posting code.
Thanks but it works now