I have a website which is already working. I have decided to chnage my hosting company. But i am having a problem getting my perl script working.

If you click on the link below it displays a list of all proeprties: http://www.goarealestates.com/cgi-bin/housing.pl?search=1&category=Buy&;submit=Go!!!

Within my script file, i have a statement as below which connects to the database

$dbh = db_connect($database,$user,$password);
And the function db_connect() is as below:-
sub db_connect { ($database,$user,$password) = @_; my $h = DBI->connect("DBI:mysql:$database", $user, $password) or printError("Unable to connect to $database" . $DBI::errstr); return $h; }
I have also got a db.cfg file which is as below
# script config file $database = "shafi"; $user = "shafi"; $password ="shafi"; 1;
But the present hosting provider has given an example of how to connect to the mysql database as below:-
================================================= #!/usr/bin/perl use DBI; print "Content-type:text/html\n\n"; $db_handle = DBI->connect("dbi:mysql:database=dbxxxxxxxx;host=dbxxx.on +eandone.co.uk;user=dboxxxxxxxx;password=xxxxxxxx") or die "Couldn't connect to database: $DBI::errstr\n"; $sql = "SELECT * FROM puretest"; $statement = $db_handle->prepare($sql) or die "Couldn't prepare query '$sql': $DBI::errstr\n"; $statement->execute() or die "Couldn't execute query '$sql': $DBI::errstr\n"; while ($row_ref = $statement->fetchrow_hashref()) { print "Name <b>$row_ref->{name}</b> has email address::< +b>$row_ref->{email}</b>.<br>"; } $db_handle->disconnect(); ===================================================
The DBI->connect statement is different and deosnt seem to work. Could someone tell me how my function should change to adapt to this hsoting provider.

Code tags added by Arunbear


In reply to DBI->connect problem by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.