Announcement

Collapse
No announcement yet.

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

Collapse
X
  • 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-21-2009, 07:18 PM.
            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

                  Search

                  Collapse

                  Advertisement

                  Collapse

                  Latest Topics

                  Collapse

                  • Happyangryman
                    Reply to Logo feedback for middle eastern restaurant
                    Happyangryman
                    Yeah you're right. Think it might have to do with me being lazy and bad at logo design. Just wanted to do something easy, simple and that looks good.

                    .
                    Worked on the skewer on fire...
                    Today, 03:52 PM
                  • Lord Daz
                    Reply to Illustrator: Path from 3D Object.
                    Lord Daz
                    THANK YOU VERY MUCH!!! I did a fast try and it's works! I need the "3D" Path to export in to a .dfx with rhino and finaly do a luser cut.

                    I didnt have time today to try with...
                    Today, 03:17 PM
                  • PrintDriver
                    Reply to First stabs at a personal logo
                    PrintDriver
                    Funny how you mention you didn't want it to read D-Chew cuz that is exactly what I got from it. More so with the first than the second.

                    I sort of rather favor the second one anyway. It has...
                    Today, 02:14 PM
                  • PrintDriver
                    Reply to Show customer Pantones used in design
                    PrintDriver
                    If you delete all unused colors out of your color palette, the printer can see at a glance what pantones are used in a document.


                    Though it is nice to have a ''standards'' page if...
                    Today, 02:09 PM
                  • B
                    Reply to Show customer Pantones used in design
                    B
                    I often do much the same thing. I'll even do it that way when sending files to printers -- just so that at a glance the printer can tell what colors are involved. The only problem I've found has nothing...
                    Today, 01:39 PM

                  20% Off Sale at iStock until Sept 30, 2016
                  GDF A division of Mediabistro Holdings Adweek | Mediabistro | Clio | Film Expo Group Contact Us | Terms of Use | Privacy Policy Copyright © 2016 Mediabistro Holdings
                  Working...
                  X