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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

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


Oct 13, 2012, 8:10 PM

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


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:

DBI connect('bcpadb;','maxwell175',...) failed: Can't connect to MySQL server on '' (111) at /home/www/ line 16

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

Full code:

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:

use CGI::Carp qw(fatalsToBrowser);

You have a syntax error on line 15.

D:\test>perl -c

syntax error at line 15, near "username>"
Bad name after LName' at 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