Some pointers need for a CGI script & Mysql

N

Newbie

Hi

I'm rather new to cgi, (I've done the ice cream and other tutorials), so I'm
not that
raw, however I'm running into a brick wall when trying to interface with
Mysql.
I can do queries ectra, but I'm hitting the wall hard when trying to add
information
to the database (it doesn't seem to be adding the infomation into the
database).
And was wondering if anyone outhere knows of any good tutorials, sample
code,
or books dealing with cgi/perl ? (I've done some searches and haven't come
up with
what I'm looking for).
At this stage I'm trying to work out whats going on and what are common
pitfalls
so at least if I hit the wall again I'll have some sort of reference point
for me to start.
( for that reason I haven't included any code, as I may be doing other
"things wrong")
Thus any pointers would be greatly appreciated.

Later
David
 
M

mgarrish

I'm rather new to cgi, (I've done the ice cream and other tutorials), so I'm
not that
raw, however I'm running into a brick wall when trying to interface with
Mysql.
I can do queries ectra, but I'm hitting the wall hard when trying to add
information
to the database (it doesn't seem to be adding the infomation into the
database).
And was wondering if anyone outhere knows of any good tutorials, sample
code,
or books dealing with cgi/perl ?

Paul Dubois has put out a couple of good books on Perl and MySQL. I believe
they're published by New Riders. Before buying a book though, I would
recommend reading over the user guides at www.mysql.com.

Matt
 
G

Gregory Toomey

Newbie said:
Hi

I'm rather new to cgi, (I've done the ice cream and other tutorials), so I'm
not that
raw, however I'm running into a brick wall when trying to interface with
Mysql.
I can do queries ectra, but I'm hitting the wall hard when trying to add
information
to the database (it doesn't seem to be adding the infomation into the
database).
And was wondering if anyone outhere knows of any good tutorials, sample
code,
or books dealing with cgi/perl ? (I've done some searches and haven't come
up with
what I'm looking for).

Add the following line to your cgis. Errors are then sent to the browser and
debugging cgi is MUCH easier.
use CGI::Carp qw(fatalsToBrowser);

Check you 'insert' syntax http://www.mysql.com/doc/en/INSERT.html
If you have access to the shell, you can run mysql directly and cut/paste
you query to check syntax:
mysql -u username -ppassword database

I find mysqlman very useful in administering mysql from the web
http://www.gossamer-threads.com/scripts/mysqlman/

gtoomey
 
C

ctcgag

Newbie said:
Hi

I'm rather new to cgi, (I've done the ice cream and other tutorials), so
I'm not that
raw, however I'm running into a brick wall when trying to interface with
Mysql.
I can do queries ectra, but I'm hitting the wall hard when trying to add
information
to the database (it doesn't seem to be adding the infomation into the
database).

Are you asking MySQL to raise errors that it encounters? Are you
either logging those errors or returning them to the browser?
Are you using transactional tables and not committing?

And was wondering if anyone outhere knows of any good tutorials, sample
code,
or books dealing with cgi/perl ? (I've done some searches and haven't
come up with
what I'm looking for).
At this stage I'm trying to work out whats going on and what are common
pitfalls
so at least if I hit the wall again I'll have some sort of reference
point for me to start.

There's nothing special about Perl used in a CGI environment. Can you
get command line scripts to work? I like DuBois's "MySQL", but then
again it's the only book I looked at on the topic.

( for that reason I haven't included any code, as I may be doing other
"things wrong")
Thus any pointers would be greatly appreciated.

Then how much can you expect us to help you? You can write a readable
CGI script to add a row to a table in about 8 lines, and then we could
tell you if you are doing other things wrong.


Xho
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,121
Messages
2,570,714
Members
47,282
Latest member
hopkins1988

Latest Threads

Top