Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New Coder
    Join Date
    Dec 2009
    Location
    Australia
    Posts
    41
    Thanks
    15
    Thanked 0 Times in 0 Posts

    MSQL data to MSQL data

    Hi

    I have a few forums within the same account but all using different MSQL databases.

    I know how to copy details from one database to another, that's not an issue.

    What I am wanting is the where and how's of creating a code so that when a new user registers in 1 of the forums that info automatically also registers them within all the other forums. (This would save them having to re-register in each forum)

    The forums all use the same script.

    If I can be done from the files themselves then I will accept that as an option as well.

    Cheers

  • #2
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    well this is a MySQL forum so I can't give you code for your flavour of SQL.

    However, what I would consider suggestiong is to create a new table in a db which would contain login details. Then make each forums login query that db table instead of whatever table it queries.

    You'll have an upset with any future upgrades to each forum, where you'll have to repeat the procedure.

    That's what I always find to be the problem with off the shelf software.

    hth

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • Users who have thanked bazz for this post:

    phil1ooo (06-19-2011)

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,189
    Thanks
    75
    Thanked 4,341 Times in 4,307 Posts
    I agree with Bazz. And I also hope that you don't *really* mean what you said:

    I have a few forums within the same account but all using different MSQL databases.
    I hope you really meant "different TABLES" all within the same database.

    If you really have multiple databases, you have a real mess on your hands.

    But, yes, assuming the multiple databases are on the same server, you *can* make cross-database references, and so, as Bazz said, you'd put all the user accounts into a *single* table in a single database and link to them from all the other tables/databases.

  • Users who have thanked Old Pedant for this post:

    phil1ooo (06-19-2011)

  • #4
    New Coder
    Join Date
    Dec 2009
    Location
    Australia
    Posts
    41
    Thanks
    15
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Old Pedant View Post
    I agree with Bazz. And I also hope that you don't *really* mean what you said:


    I hope you really meant "different TABLES" all within the same database.

    If you really have multiple databases, you have a real mess on your hands.
    What I have is 2 forums at the moment but will be increased once I can solve this issue so I can impliment it for all the others as well. How I have it setup is each use a different domain name and are about totally different topics.

    I tried creating the whole lot within a single forum but it just creates a hugh mess of confussion for everybody.

    Anyway being all different domains yes they are all using their own databases as using the same database for all would create issues for other aspects of the forum as not all have the exact same features.

    Unless you can help suggest a better idea as I am not all that savvy with coding.

    Cheers

  • #5
    New Coder
    Join Date
    Dec 2009
    Location
    Australia
    Posts
    41
    Thanks
    15
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by bazz View Post
    However, what I would consider suggestiong is to create a new table in a db which would contain login details. Then make each forums login query that db table instead of whatever table it queries.
    It sounds like what I call a db you call a table (Not sure though) from what i understand you are saying i could have a registration script setup using a different db(table) and use this script as my main registration and login form. them make the forums use those details to log-in.

    If i am right then I would ba able to use that log-in/registration form for other websites as well then (Correct?)

    If I am wrong, please explain a bit more about what you mean please.

    Cheers

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,189
    Thanks
    75
    Thanked 4,341 Times in 4,307 Posts
    In a nutshell: Yes.

    And if you really have separate databases, then the CONNECTION STRINGS used for each will be different.

    If you only have separate *TABLES* then the connection strings will be the same.

    If you really do have separate databases, then the syntax to join from one to the other is only a bit more complex. See here:
    http://msdn.microsoft.com/en-us/libr...v=SQL.80).aspx

    (I assume, as did Bazz, that by "MSQL" you mean Microsoft SQL Server.)

    What language/system are you writing your web pages in? ASP.NET? ASP? If so, show me your connection strings and I'll know for sure.

    The more I think of it, the more likely it is that you *do* mean different databases. Because normally each forum would need multiple tables, so it's more likely that you'd have one set of multiple tables in a single database, one database for each forum. Again, the connection strings will tell us the story.

  • Users who have thanked Old Pedant for this post:

    phil1ooo (06-19-2011)

  • #7
    New Coder
    Join Date
    Dec 2009
    Location
    Australia
    Posts
    41
    Thanks
    15
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Old Pedant View Post
    In a nutshell: Yes.

    And if you really have separate databases, then the CONNECTION STRINGS used for each will be different.

    If you only have separate *TABLES* then the connection strings will be the same.

    If you really do have separate databases, then the syntax to join from one to the other is only a bit more complex. See here:
    http://msdn.microsoft.com/en-us/libr...v=SQL.80).aspx

    (I assume, as did Bazz, that by "MSQL" you mean Microsoft SQL Server.)

    What language/system are you writing your web pages in? ASP.NET? ASP? If so, show me your connection strings and I'll know for sure.

    The more I think of it, the more likely it is that you *do* mean different databases. Because normally each forum would need multiple tables, so it's more likely that you'd have one set of multiple tables in a single database, one database for each forum. Again, the connection strings will tell us the story.
    NO I am using a cPanel/phpMyAdmin MySQL databases, .php, .html files within a Linux Server.

    I can reinstall the new forum into the other forums database if that will help make things easier to work with but I would still have to use a different (yyy_databasename_filename) which I didn't do thinking that the members database file would still be different. But if it will help join the 2 together then i am willing to make the change.

    Cheers

  • #8
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    Quote Originally Posted by phil1ooo View Post
    NO I am using a cPanel/phpMyAdmin MySQL databases, .php, .html files within a Linux Server.
    could be worse. lol

    I don't understand this bit..

    but I would still have to use a different (yyy_databasename_filename)
    be careful if moving tables from one db to another, especially if the forums are already live. I am sure you know the nightmare that you could give yourself.

    I'll wait for your answer to Old_Pedant before saying more so I would be more likely to be relevant.

    @Old_Pedant, yes I assumed he meant MSSQL or something else.
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • Users who have thanked bazz for this post:

    phil1ooo (06-19-2011)

  • #9
    New Coder
    Join Date
    Dec 2009
    Location
    Australia
    Posts
    41
    Thanks
    15
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by bazz View Post
    could be worse. lol

    I don't understand this bit..



    be careful if moving tables from one db to another, especially if the forums are already live. I am sure you know the nightmare that you could give yourself.

    I'll wait for your answer to Old_Pedant before saying more so I would be more likely to be relevant.

    @Old_Pedant, yes I assumed he meant MSSQL or something else.
    What I meant is,
    Code:
    Table Settings
        $tablepre       = 'db_'; //
    Both forums use a different name_ there meaning installing multiple sites within the same database using different Name_ so each site doesn't mix files is the same thing as installing it on a seperate database.

    I am sorry if my terminologies are different or if I explain myself in a way that makes it harder for you to better understand what I mean as I am no expert,, just selftought.

    Question Please;

    Is it possible to create a completely different db for registrations only and use this db for all websites having different domain names and/or on different accounts but all on the same server using the same WHM root panel. I use a dedicated server. Wouldn't just be a matter of recoding the Login and reistration codes to all read from the exact same database. If this could be done it would be a blessing.
    Last edited by phil1ooo; 06-18-2011 at 11:32 PM.

  • #10
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,189
    Thanks
    75
    Thanked 4,341 Times in 4,307 Posts
    Yes, of course you could (and should) use yet another database for the registrations. What Bazz and I wonder about are if you intend to (or need to) join from the registration database to the forum databases.

    I *think* you probably will. I would hope and assume that the only place that user names are recorded is in some sort of "registered_users" table.

    And so, for example, a query that show the name of all responders to a given message will presumably JOIN from the messages table to the registered_users table.

    Something like:
    Code:
    SELECT r.username, t.threadtitle, m.messagetime, m.messagetext
    FROM registered_users AS r, threads AS t, messages AS m
    WHERE r.userid = m.userid 
    AND t.threadid = m.threadid
    AND m.messagetime > DATE_SUB( now(), interval 1 hour )
    ORDER BY t.threadid, m.messageid
    Okay, so if you move the registered_users table to another database, then you now have to "find" that table in the other database.

    That's pretty easy with MySQL if both db's are one the same server. You just have to fully qualify the table name:

    Instead of just registered_user as r you will use something like registrationdb.registered_user as r

    But it sounds to me like you didn't write any of this code yourself. Are you ready to go poring through the code, finding all references to the registration table, and making the proper adjustements to the SQL queries??

  • Users who have thanked Old Pedant for this post:

    phil1ooo (06-19-2011)

  • #11
    New Coder
    Join Date
    Dec 2009
    Location
    Australia
    Posts
    41
    Thanks
    15
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Old Pedant View Post
    Yes, of course you could (and should) use yet another database for the registrations. What Bazz and I wonder about are if you intend to (or need to) join from the registration database to the forum databases.

    I *think* you probably will. I would hope and assume that the only place that user names are recorded is in some sort of "registered_users" table.
    That's Great, Since it can be done then this will be my new project to have a single rego system for all my websites.

    Yes all users are in a database table as you mentioned above.

    But it sounds to me like you didn't write any of this code yourself. Are you ready to go poring through the code, finding all references to the registration table, and making the proper adjustements to the SQL queries??
    Yes you are correct I am not able to do the work myself as much as I would love to be able to.
    I am searching for solutions and methods of being to make things work the way I want them to. Then when I look for someone to actually do the work I know or at least have a better idea of what I want and what to expect as well as what they need to do.

    I actually have already created a registration db myself and have been working/attempting to make this work myself but it's way out of my ability. It has it own admin which can/should be able to control all users from a single panel for all websites.

    If you know anyone who can implemet these ideas then please tell me. I always pay for work done as I never expect it for free being well aware of the time and work involved.

    I own a bunch of newly created websites as well as the forums and being able to intorduce a single registration process for all of them is my goal. I have succeeded in doing the same thing with all my support, contact, help, forum and other aspects of all my websites. It just now leaves the rego/log-in department to work the way I need it to.

    Cheers
    Last edited by phil1ooo; 06-19-2011 at 02:01 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •