dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: How To Save Data to a SQL database using Perl??

  1. #1
    Join Date
    Mar 2003
    Posts
    5

    Question How To Save Data to a SQL database using Perl??

    Hi everyone,
    How To Save Data to a SQL database using Perl??
    Can someone show me the code or ways to do so?
    thanks

  2. #2
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413
    That was my next question... I'll wait for the answer. Thanks.

  3. #3
    Join Date
    Feb 2003
    Location
    wilmington
    Posts
    17

    I'm a beginner too

    Go to your local library and get a copy of CGI Programming 101 there is an awesome chapter on this (Chapter 18)


    or go to cgi101.com and look at some source code if u think that will be enough to help you

  4. #4
    Join Date
    Dec 2002
    Location
    Pleasanton, CA
    Posts
    2,132
    #!/usr/local/bin/perl
    use DBI;

    my $db_name = "database name";
    my $db_uid = "userid";
    my $db_pwd = "password";
    my $dsn = "DBI:mysql:$db_name";
    my $dbh = DBI->connect($dsn,$db_uid,$db_pwd);
    ...
    # Basic method. There are a others
    $query = "INSERT INTO TableName VALUES('$item1', .. same number of (quoted) items as columns in your table ..')";
    $dbh->do($query);
    ...
    $dbh->disconnect(); # when you are done using the database
    exit;

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles