[URGENT] CGI won't connect to database

Discussion in 'Programming' started by bscdesign.com, Jun 23, 2007.

  1. #1
    I own a scripts store and a customer is having trouble getting our newsletter script to work. I have found the problem.

    The problem is that his server won't let him connect to the database because of this line of code:
    $dbh = DBI->connect($dbdata,$dbuser,$dbpass);
    Code (markup):
    That brings up a 500 internal server error evey time the script tries to connect to his mysql database.

    His server requires that the string has quotes around it like so:
    $dbh = "DBI->connect($dbdata,$dbuser,$dbpass)";
    Code (markup):
    That makes the configuration file work but when trying to connect to the database it still gets the 500 error because that code is not suppost to have quotes around it.

    I have gone through the files and added the code manually like so:
    DBI->connect($dbdata,$dbuser,$dbpass)->do($sql);
    Code (markup):
    But it still won't work. I am sure there is a simple fix that I haven't thought of. Can anyone help?
     
    bscdesign.com, Jun 23, 2007 IP
  2. bscdesign.com

    bscdesign.com Active Member

    Messages:
    681
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    58
    #2
    I fixed it. The problem was actually that the config.cgi file wasn't transfering it's variables to the other files.
     
    bscdesign.com, Jun 24, 2007 IP