I am currently learning Perl CGI using a book I have. I now want to write a script that receives a person's name as an argument then, looks up the person in the database and returns the Name and Email.

check these to make sure that MySQL module is installed which would be DBD::mysql module if not youll need to install it. Is it connecting to the database correctly? also the $console sometimes is better to use an ? (alias)

Re: [MDTech.us_MAN] Need help writing a script that interacts with a MySQL DB
[In reply to]

Can't Post

You should always tell us what errors you're receiving so that we can better assist you.

Why did you comment out the use strict; line? It's very important to include that in every Perl script you write so that it can point out some of your mistakes. It's common for people on forums like this to not help unless you include the strict pragma in your code.

Two mistakes that you made are 1) line 37 is missing the terminating semicolon and 2) line 45 has an extra = equals character.

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.

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.

Re: [MDTech.us_MAN] Need help writing a script that interacts with a MySQL DB
[In reply to]

Can't Post

The verbiage of the error message you posted doesn't match the die statement in the code you posted, which tells me that the code you ran was not the code you posted or you altered the veriage when posting, so at this point it's anyone's guess as to the problem.

Re: [FishMonger] Need help writing a script that interacts with a MySQL DB
[In reply to]

Can't Post

In Reply To

The verbiage of the error message you posted doesn't match the die statement in the code you posted, which tells me that the code you ran was not the code you posted or you altered the veriage when posting, so at this point it's anyone's guess as to the problem.