coldfingertips has asked for the wisdom of the Perl Monks concerning the following question:
The errors revolve around
In which its sayingmy @row; my $cnt = -1; while(@row = $sth->fetchrow_array) { $cnt++; print "$row[$cnt] test<br>"; }
However, I am indeed predeclaring both @row and $cnt before the loop even begins. So something else must be wrong and I can't put my finger on it.Global symbol "@row" requires explicit package name at admin.pl line 1 +65. Global symbol "$cnt" requires explicit package name at admin.pl line 1 +65. Global symbol "@row" requires explicit package name at admin.pl line 1 +65. Global symbol "$cnt" requires explicit package name at admin.pl line 1 +65. Global symbol "@row" requires explicit package name at admin.pl line 1 +65. Global symbol "$cnt" requires explicit package name at admin.pl line 1 +65.
Can someone see where I goofed in the code below?
if ($action =~ m/upload/i) { print <<" EOF"; <table width="400" border="1" cellspacing="0" bordercolor="#0000 +FF"> <form action="" method="post" enctype="multipart/form-data"> <tr> <td width="456" height="53"><table width="447" cellspacin +g="0"> <tr bgcolor="#FFCCFF"> <td colspan="2"><div align="center">Upload file to user < +/div></td> </tr> <tr> <td width="234">File:</td> <td width="206"><input name="upload" type="file" id="uplo +ad"></td> </tr> <tr> <td>User:</td> <td><select name="select" MULTIPLE size="5"> END my $data = qq(SELECT username FROM login); my $sth = $dbh->prepare($data); $sth->execute() or die $sth->errstr; my @row; my $cnt = -1; while(@row = $sth->fetchrow_array) { $cnt++; print "$row[$cnt] test<br>"; } print <<" EOF"; </select></td> </tr> <tr> <td colspan="2"><div align="center"> <input name="UploadFile" type="submit" id="UploadFile" value +="Upload"> </div></td> </tr> </table></table> EOF }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problems with sth->fetchrow array or another syntax error
by imp (Priest) on Aug 29, 2006 at 16:51 UTC | |
by coldfingertips (Pilgrim) on Aug 29, 2006 at 17:00 UTC | |
by GrandFather (Saint) on Aug 29, 2006 at 18:51 UTC | |
by tye (Sage) on Aug 29, 2006 at 19:07 UTC | |
by imp (Priest) on Aug 29, 2006 at 19:18 UTC | |
|
Re: Problems with sth->fetchrow array or another syntax error
by bart (Canon) on Aug 29, 2006 at 20:09 UTC |