You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
519 B
Perl

#!/usr/bin/perl
use DBI;
use strict;
my $username = "dbuser";
my $password = "dbpassword";
my $dsn = "dbi:mysql:goo:192.168.1.10";
my $dbh = DBI->connect($dsn,$username,$password) or die "Cannot connect to database: $DBI::errstr";
my $sth = $dbh->prepare("INSERT INTO urls VALUES('','http://www.demo.org/','suehring',unix_timestamp(),'query words')");
$sth->execute() or die "Cannot execute sth: $DBI::errstr";
my $insertid = $dbh->{'mysql_insertid'};
print "$insertid\n";
$dbh->disconnect();