Perl中的一个简单的错误我在准备发言使用DBI
$sqlst = $dbh->prepare('SELECT * FROM starter_trot WHERE UserId = 2345') or die "Couldn't prepare statement: " . $dbh->errstr;
$sqlst->execute($userid) or die "Couldn't execute statement: " . $sqlst->errstr;
my @data;
print"hai";
while (@data = $sqlst->fetchrow_array())
{
print "**";
}
执行语句和准备语句,肯定不会失败一个错误。
[WHERE UserId = 2345]这是它失败的部分。当我在db中运行查询时,它会回退values.But当我通过脚本运行查询时,它失败(但没有编译或运行时问题)什么是问题。它在准备我们必须要付出吗?(绑定变量而不是实际值?) 〜 〜
什么是整个错误信息? – 2011-05-24 12:53:56
尝试将\ n添加到打印的字符串的末尾;也许输出只是被缓冲? – ysth 2011-05-24 13:27:33
没有错误信息..我没有得到数组中的结果.... – user682571 2011-05-24 13:57:24