On 14 Feb 2002, at 12:13, Richard C Rossy wrote: > > Ok I can't seem to get this. Now is it possible to have MySQL on a > other computer and run the script. In other words the perl script is > on foo.com and MySQL database is on foo2.com. What is need to make the > script work. What I have in the script is: > > Configure.pl > > sub configure { > ######################################## > # CGI CONFIGURATION VARIABLES > ######################################## > $mailprogram = "/usr/sbin/sendmail -t"; > $mysqlhost = "mysql.foo2.com 3306";
According to the fine manual, this should read $mysqlhost = "mysql.foo2.com:3306"; I prefer(ed) to $mysqlhost="mysql.foo2.com"; $mysqlport= 3306; and go on as shown below > $mysqldatabase = "matchpro"; > $mysqlusername = "username"; > $mysqlpassword = "password"; > add.pl > > #!/usr/bin/perl -s > use Socket; > use DBI; > > require "configure.pl"; > &configure; > open (HEADERHTML, "$headerhtml"); > @header = <HEADERHTML>; > close HEADERHTML; > open (FOOTERHTML, "$footerhtml"); > @footer = <FOOTERHTML>; > close FOOTERHTML; > > $orderid = &generateorderid; > $profilenumber = $orderid; > > &form_parse; > $AdHeadline = $FORM{'AdHeadline'}; > $EmailAddress = $FORM{'EmailAddress'}; > $TelephoneAreaCode = $FORM{'TelephoneAreaCode'}; > $City = $FORM{'City'}; > $StateProvince = $FORM{'StateProvince'}; > $Zip = $FORM{'Zip'}; > $Country = $FORM{'Country'}; > $RelationshipPreference = $FORM{'RelationshipPreference'}; > $SexualPreference = $FORM{'SexualPreference'}; $Username = > $FORM{'Username'}; $Password = $FORM{'Password'}; > $VerifyPassword = $FORM{'VerifyPassword'}; > $SmokingPreference = $FORM{'SmokingPreference'}; > $DrinkingPreference = $FORM{'DrinkingPreference'}; > $MaritialStatus = $FORM{'MaritialStatus'}; $HaveChildren = > $FORM{'HaveChildren'}; $BodyBuild = $FORM{'BodyBuild'}; > $Height = $FORM{'Height'}; $Religion = $FORM{'Religion'}; > $Race = $FORM{'Race'}; $AstrologicalSign = > $FORM{'AstrologicalSign'}; $Age = $FORM{'Age'}; $Occupation > = $FORM{'Occupation'}; $MiscComments = > $FORM{'MiscComments'}; > $MiscComments =~ s/ /\|/g; > $MiscComments =~ s/\s/\|/g; > $MiscComments =~ s/\|+/ /g; > > > $dbh = DBI->connect("DBI:mysql:$mysqldatabase", > "$mysqlhost","$mysqlusername", "$mysqlpassword") || die("Couldn't > connect to database!\n"); $dbh = DBI- >connect("dbi:mysql:database=$mysqldatabase;host=$mysqlhost;port=$mysq lport", $mysqlusername, $mysqlpassword, {RaiseError =>1}) or die $DBI::errstr; > print "Content-type: text/html\n\n"; > &printheader; &errcheck; &checkuniqueusernames; &checkuniqueemails; > &savedata; &printconfirmation; &printfooter; &emailmember; > > $dbh->disconnect; > > There is more but the script never gets past $dbh = DBI > If I remember it right, 3306 is the default mysql port, so it should be possible to omit specifying it anyways. HTH Bodo