CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [FishMonger] Need help writing a script that interacts with a MySQL DB: Edit Log



MDTech.us_MAN
Novice

Oct 13, 2012, 8:10 PM


Views: 13056
Re: [FishMonger] Need help writing a script that interacts with a MySQL DB

Hello,

Thanks very much for the suggestion! that helped diagnose the problem, because I don't have access to the logs.

Here is the new problem:

Code
DBI connect('bcpadb;host=instance28854.db.xeround.com:18847','maxwell175',...) failed: Can't connect to MySQL server on 'instance28854.db.xeround.com' (111) at /home/www/mdtech.us.ms/BCPA/BCPA_form/PROC/index.cgi line 16


@wickedxter: I manually change <password> or <the password> to my actual db password. (not a variable)

Full code:
http://pastebin.com/iQYnTPUB






In Reply To
Did you check the web server error log to see if it gives you a clue to the problem?

While debugging CGI scripts, you should include this module:
http://search.cpan.org/~markstos/CGI.pm-3.60/lib/CGI/Carp.pm

Code
use CGI::Carp qw(fatalsToBrowser);


You have a syntax error on line 15.

D:\test>perl -c MDTech.us_MAN.pl

Quote
syntax error at MDTech.us_MAN.pl line 15, near "username>"
Bad name after LName' at MDTech.us_MAN.pl line 16.


Line 15 is missing the closing ' on the DSN portion of the statement and could very well be the source of blank page problem.

IMO, you should use double quotes when you need interpolation and single quotes when you don't need interpolation. We don't have enough info from what you've posted to make a firm statement on which you should be using in this case.

I disagree with wickedxter on the quoting of the username, password, and hash keys. Use single quotes for the username/password or non at all if you're using vars. Hash keys rarely ever need quoting. Two exceptions are when they include spaces or hyphens.

Since you're using RaiseError => 1 in the connect statement, adding the die statement on the rest of the sql statements is redundant and unnecessary.

I'm tied up working on a PGA tournament, but if I get some free time, I'll post more recommendations.



(This post was edited by MDTech.us_MAN on Oct 14, 2012, 11:47 AM)


Edit Log:
Post edited by MDTech.us_MAN (Novice) on Oct 13, 2012, 8:16 PM
Post edited by MDTech.us_MAN (Novice) on Oct 14, 2012, 11:47 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives