fetchrow_arrayref. Fetches the next row of data and returns it as a list containing the field values.
In your assignment:
You are assigning a list to a scalar. i.e. $aref is a SCALAR .$aref = $sth->fetchrow_array;
The next statement, you try to dereference $aref as an array ref.
If you had use warnings; it would say:
Useless use of a constant (..) in void context at ...
In any case, @$aref is empty.
It would also be helpful to do error checking (RaiseError, or check $sth->err).
If you are confident that the fetchrow_array returns a value, try:
Update:Corrected doc reference from fetchrow_arrayref to fetchrow_array. Thanks McA for pointing this out.($aref )= $sth->fetchrow_array; print "GOT |$aref|\n";
Profanity is the one language all programmers know best.
In reply to Re: SQL statement produces no results when executed using DBI's prepared statement, but one record when executed directly in MySQL. WHY?
by NetWallah
in thread SQL statement produces no results when executed using DBI's prepared statement, but one record when executed directly in MySQL. WHY?
by ted.byers
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |