Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

How to use MySQL from CGI?

by Anonymous Monk
on Feb 04, 2004 at 19:55 UTC ( [id://326581]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: How to use MySQL from CGI?
by cchampion (Curate) on Feb 04, 2004 at 20:23 UTC
Re: How to use MySQL from CGI?
by matthewb (Curate) on Feb 04, 2004 at 20:29 UTC
    Can someone just give me a snippet on how to connect to a MySQL db from a website?
    #!/usr/bin/perl -T use warnings FATAL => 'all'; use strict; use DBI; use CGI; my( $dsn, $username, $password ) = qw( you tell me ); my $dbh = DBI->connect( $dsn, $username, $password ) or die DBI::errstr; my $q = CGI->new; print $q->header, $q->h1( "Looks like we connected to $dsn!" ); exit;

    You have much reading to do.

    MB
Re: How to use MySQL from CGI?
by blue_cowdawg (Monsignor) on Feb 04, 2004 at 21:07 UTC

    Let me suggest the following reading to you:

    1. Before You Post ...
    2. How (Not) To Ask A Question
    3. Before asking a database related question ...
    4. DBI recipes
    I know it isn't quite what you were asking for, but some effort on your part will help you in the long run better than my spoon-feeding you.


    Peter L. Berghold -- Unix Professional
    Peter at Berghold dot Net
       Dog trainer, dog agility exhibitor, brewer of fine Belgian style ales. Happiness is a warm, tired, contented dog curled up at your side and a good Belgian ale in your chalice.
Re: How to use MySQL from CGI?
by BUU (Prior) on Feb 04, 2004 at 21:50 UTC
    The only difference between a "command line" and a "cgi" script, at least for 99% of perl scripts, is you print html instead of just printing the data. It should be trivial to generalize from a command line example to a cgi example and vice versa.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://326581]
Approved by cchampion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (8)
As of 2024-04-24 12:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found