这就是我的表格:
key | driver | machine | result ----------------------------------- 1 | 1234 | abc_machine | pass 2 | 1234 | xyz_machine | fail
当用户从驱动程序中选择"1234"时,所有来自机器的东西都会变得有点混乱.(用户从gui中选择)
当我做:
$getConfig = `sqlite3 abc.db "SELECT machine FROM $table_name WHERE driver='$drvrSel'"`;
它给了我abc_machine xyz_machine
.
我尝试将它们分开使用split(/ /, $getConfig)
,但不起作用.
谢谢.
如果我在错误的地方提出这个问题,我很抱歉.我试着寻找合适的地方但找不到它.
#!/usr/bin/perl use DBI; use strict; my $dbargs = {AutoCommit => 0, PrintError => 1}; my $dbh = DBI->connect("dbi:SQLite:dbname=test.db","","",$dbargs); my $sth = $dbh->prepare("SELECT machine FROM test WHERE driver = 1234"); $sth->execute(); my @data; while (@data = $sth->fetchrow_array()) { print $data[0] . "\n"; } $sth->finish; $dbh->disconnect;