- 论坛徽章:
- 0
|
perl程序问题?菜
- #!/usr/bin/perl -w
- use strict;
- use DBI;
- use DBI;
- my $dbh = DBI->;connect('DBI:mysql:test','root','') or die "无法连接数据库: " . DBI->;errstr;
- my $sth = $dbh->;prepare(q{INSERT INTO add (name) VALUES ('aaa') });
- $sth->;execute()
- $dbh->;disconnect;
复制代码
我想在test数据库中的表add中插入一条name='aaa'记录。
结果运行不对
- [root@leap mail]# ./mysql.pl
- Scalar found where operator expected at ./mysql.pl line 16, near ")
- $dbh"
- (Missing semicolon on previous line?)
- syntax error at ./mysql.pl line 16, near ")
- $dbh"
- Execution of ./mysql.pl aborted due to compilation errors.
复制代码
请问错在哪了@@@ |
|