violinrocker Posted May 7, 2011 Share Posted May 7, 2011 im using a function which connects to a db called 'comments' and then inside that function i again called another function that will connect to the db 'main' to get avatars.... but as i put mysql_select_db("main") or die(mysql_error()); on the new function, the original function stops to fetch rows. i tried to remove "mysql_select_db("main") or die(mysql_error());" and used the new function to return some text only and it worked, so i guess the connection to the db was the problem... i tried doing mysql_query("SELECT * FROM main.avatar INNER JOIN main.list ON main.avatar.title=main.list.id WHERE main.avatar.page_id='$id'"); but it also didnt work Quote Link to comment https://forums.phpfreaks.com/topic/235766-using-a-new-connection-inside-the-function-of-a-function/ Share on other sites More sharing options...
wildteen88 Posted May 7, 2011 Share Posted May 7, 2011 Why have diffident databases for comments? You're better of storing your comments within a table called comments that is in your main database. Quote Link to comment https://forums.phpfreaks.com/topic/235766-using-a-new-connection-inside-the-function-of-a-function/#findComment-1211928 Share on other sites More sharing options...
violinrocker Posted May 7, 2011 Author Share Posted May 7, 2011 i have them in different dbs long before i thought of that function... and now i have thousands of rows in both of those dbs Quote Link to comment https://forums.phpfreaks.com/topic/235766-using-a-new-connection-inside-the-function-of-a-function/#findComment-1211931 Share on other sites More sharing options...
jcbones Posted May 7, 2011 Share Posted May 7, 2011 Just copy the table over to your `main` database. Quote Link to comment https://forums.phpfreaks.com/topic/235766-using-a-new-connection-inside-the-function-of-a-function/#findComment-1211941 Share on other sites More sharing options...
spiderwell Posted May 7, 2011 Share Posted May 7, 2011 Just copy the table over to your `main` database. this, then you are sorted (in theory) Quote Link to comment https://forums.phpfreaks.com/topic/235766-using-a-new-connection-inside-the-function-of-a-function/#findComment-1211989 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.