Announcement Announcement Module
Collapse
No announcement yet.
Connecting php/MySQL to HTML... HELP PLEASE? Page Title Module
Move Remove Collapse
Search Search Module
Collapse

Advertisement Advertisement Module
Collapse

Featured Images Featured Images Module
Collapse

Mediabistro Creative Sites Mediabistro Creative Sites Module
Collapse
Latest Topics Latest Topics Module
Collapse

Advertisement Advertisement Module
Collapse

Sponsors Sponsors Module
Collapse

X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

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

    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'?
    Monarchs Rule!

    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, 01:18 AM.
            The world is divided into people who think they are right.
            —Anonymous

            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
                The world is divided into people who think they are right.
                —Anonymous

                Comment


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

                  Thanks for all the help, guys.

                  Comment

                  Mediabistro A division of Prometheus Global Media home | site map | advertising/sponsorships | careers | contact us | help courses | browse jobs | freelancers | content | member benefits | reprints & permissions terms of use | privacy policy Copyright © 2014 Mediabistro Inc.
                  Working...
                  X