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

Re: How to use MySQL from CGI?

by matthewb (Curate)
on Feb 04, 2004 at 20:29 UTC ( #326590=note: print w/replies, xml ) Need Help??


in reply to How to use MySQL from CGI?

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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://326590]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2020-09-24 12:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (133 votes). Check out past polls.

    Notices?