Announcement Announcement Module
Collapse
No announcement yet.
Connecting php/MySQL to HTML... HELP PLEASE? Page Title Module
Move Remove Collapse
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Connecting php/MySQL to HTML... HELP PLEASE?

    #1
    Alright, here's my problem...
    I have a website that is setup using php/mysql to update things like product listings, authorized dealers, and news/press releases. Everything works.

    I need to set up a similar site, which will have all the capabilities of the first but with different data. It's a new division of our company, and the demographic is different. We don't want the 2 sites sharing content.

    What I've done so far:
    I have the 2nd site setup, coded, etc. Everything works except the database. I copied everything over and was able to connect to the FIRST database.

    I created a new database, backed up the 1st, and restored it to the new db. I did this for simplicity, so I don't need to recreate everything.

    I cleared most of the content from the 2nd db, leaving only what I need for the 2nd site.

    How do I connect to the 2nd db, from the 2nd site?

    I can post links or code, if needed. Here's a snippet from the 1st site.

    Code:
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <!--#include file="../../Connections/ksport.asp" -->
    <%
    Dim rsMotorsports__varID
    rsMotorsports__varID = "null"
    If (request.queryString("press_id") <> "") Then 
      rsMotorsports__varID = request.queryString("press_id")
    End If
    %>
    And the same section of code from the 2nd site, with minor modifications that I made in attempt to get this working.

    Code:
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <!--#include file="../../Connections/moben.asp" -->
    <%
    Dim rsMotorsports__varID
    rsMotorsports__varID = "null"
    If (request.queryString("press_id") <> "") Then 
      rsMotorsports__varID = request.queryString("press_id")
    End If
    %>
    I did create a new file in the "connections" folder. here's it's code.

    Code:
    <%
    ' FileName="Connection_odbc_conn_dsn.htm"
    ' Type="ADO" 
    ' DesigntimeType="ADO"
    ' HTTP="true"
    ' Catalog=""
    ' Schema=""
    Dim MM_moben_9376_STRING
    MM_moben_9376_STRING = "dsn=ksport;uid=moben_9376;pwd=****;"
    %>
    and here is the old connections file:

    Code:
    <%
    ' FileName="Connection_odbc_conn_dsn.htm"
    ' Type="ADO" 
    ' DesigntimeType="ADO"
    ' HTTP="true"
    ' Catalog=""
    ' Schema=""
    Dim MM_ksport_STRING
    MM_ksport_STRING = "dsn=ksport;uid=*******;pwd=*******;"
    %>

    Sorry for the huge post. Just wanna give you guys all the info I can up front.

  • #2
    you just need to change the database name in the connection file to the name of your second database, and make sure the user name/password match your second database as well...

    in the new connections file above, perhaps dsn=ksport should be 'moben'?

    Comment


    • #3
      I believe I've tried that.

      I forgot to mention that the 2nd database is hosted on a different server than the first. Also, the website is on it's own server. Cheap webhosts ftl...

      Comment


      • #4
        then check with the webhosts if they allow remote *sql connections the "cheap" hosts normally deny those requests and that may be the whole problem.

        Comment


        • #5
          I'll look into that. I'm sure they do, though, considering the 1st site works.
          Thanks for that suggestion, though.

          Oh, the joys of taking over someones job...

          Comment


          • #6
            Originally posted by Drazan View Post
            then check with the webhosts if they allow remote *sql connections the "cheap" hosts normally deny those requests
            Originally posted by Pendulum View Post
            I'll look into that. I'm sure they do, though, considering the 1st site works.
            I'm not sure you understood what Drazan was telling you. You said: "the 2nd database is hosted on a different server than the first. Also, the website is on it's own server".

            Site #1 works because it's making calls to a local database. If Site #2 is hosted on a different server but it's trying to connect to a database on Site #1, then Site #1 needs to allow remote connections to it's database from the server that Site #2 resides on. If it doesn't, then the connection is going to be refused by Site #1.

            Digi
            Last edited by digizan; 10-22-2009, 12:18 AM.

            Comment


            • #7
              I guess I should have been more clear...
              Everything is hosted by the same company.

              Both websites are on one server.
              Each database is on it's own server, for a total of 3 servers.

              Comment


              • #8
                Originally posted by Pendulum View Post
                I guess I should have been more clear...
                Everything is hosted by the same company.

                Both websites are on one server.
                Each database is on it's own server, for a total of 3 servers.
                So then your setup is:

                Server #1 @ cheaphost.com
                server1.site1.com
                server1.site2.com

                Server #2 @ cheaphost.com
                server2.database1

                Server #3 @ cheaphost.com
                server3.database2

                DB Connections
                server1.site1.com -> server2.database1 (works)
                server1.site2.com -> server3.database2 (doesn't work)

                If the above is correct AND you're 100% certain that all of your db names, usernames, passwords, and any paths to connections settings files are correct AND you know for a fact that remote connections are allowed from server1.site2.com -> server3.database2, then it doesn't make sense for things not to be working.

                I would suggest that you contact cheaphost.com and notify them of what you've tried as well as any db error messages you're receiving. If everything is hosted by them, then they should be able to help you track down the problem—maybe something on server3.database2 is misconfigured or whatever. For us to continue to attempt to guess at the problem from afar is at best an exercise in futility.

                Digi

                Comment


                • #9
                  Alright, I'll give that a shot.

                  Thanks for all the help, guys.

                  Comment

                  Google search Google search Module
                  Collapse
                  Latest Topics Latest Topics Module
                  Collapse
                  • ccpenn's Avatar
                    A client in the city wants to meet next week to talk about a website. I was referred by a previous client. Should I bring my laptop?
                    Or get business cards made?
                  • Typically's Avatar
                    I finally got myself an extra 2tb drive that i will be backing up my files on. I have a backup option with my Norton Security Suite, but wanted to see if anyone had alternatives or what you use. I'm on...
                  • BJMRamage's Avatar
                    Commented to Secured pdfs
                    OK, I usually do it via Acrobat. Not sure if my CS4 ir CS5 at home allows InDesign security stuff...never really tried since with invoices i do the math in acrobat.



                    Good to...
                  • Red Kittie Kat's Avatar
                    Commented to Company logo
                    Welcome Aboard



                    I don't see an image. You may be having trouble uploading or posting a link due to the Forum Upgrade that is in process.



                    That being...
                  • raynedeer's Avatar
                    I am quite new to illustrator and need some advice on how to do something. I want to create a vector of the Gankyil symbol (http://en.wikipedia.org/wiki/File:Sam_Taeguk.jpg). Does anyone have any tips...
                  • garricks's Avatar
                    Commented to Secured pdfs
                    BJMR, there is, but you have to password secure the document. Choose PDF export from the Indy File menu, and in the Export box click Security. In the Permissions pane, chick "Use a password," then enter...
                  • KeMcCaL's Avatar
                    This is a logo that has been with the company I work at for 20+ years. I wanted to get the virtual public's opinion on how it has weathered the test of time....
                  • Lith's Avatar
                    Commented to Secured pdfs
                    Smallest File Size is what I do too. It's always interesting when they come back and ask for a higher res, using professional terminology that either someone fed them or they read online. Sometimes I'll...
                  All Creative World Network All Creative World Network Module
                  Collapse
                  WebMediaBrands
                  Mediabistro | SemanticWeb | Inside Network
                  Jobs | Education | Research | Events | News
                  Advertise | Terms of Use | Privacy Policy
                  Copyright WebMediaBrands Inc. All rights reserved.
                  Working...
                  X