If I'm reading dragonchild's SQL properly, 'dual' is his table name. His SQL query says, "Select the column named 1 from the table named 'dual'". What's not to support?
There is a missing $sth->execute() though, as someone else already identified. After you prepare the query, you have to execute it before $sth->fetchrow_array() begins populating.
The code has one other potential problem which is unrelated to the error message. That is that $sth->fetchrow_array() fetches one row each time you invoke it. But the query prepared is asking for the column named "1" from all rows of "dual". That means that unless the database has only one row, you're doing a lot of work just to throw everything away except for the first row fetched. The more common idiom is:
while ( my @row = $sth->fetchrow_array() ) {
# process the row of data
}
HTH
|