I am getting odd (to me) behavior from fetchrow and wonder if anybody else is aware of this problem. Apologies in advance if I've overlooked something really obvious, or if this is a long-squashed bug and I just need to update our Perl modules.
Using Perl 5.6.0, DBI 1.14, DBD::mysql 2.0414, and MySQL 3.23.49. $sth = $dbh->prepare("SELECT PeopleID, Lastname, Email FROM People"); $sth->execute; $sth->bind_columns(\$PeopleID, \$Lastname, \$Email); while ( $sth->fetchrow ) { print "ID: $PeopleID\n" , "Name: $Lastname\n" , "Email: $Email\n\n"; } IF the last value (Email) in any row is an empty string, the fetchrow method returns false (and any remaining rows are not processed). Very bad when the *first* row in the data set happens to have a blank value in the last column. I first thought this was due to the "Email" column in my particular table, where it is not a primary key but is still required to be unique. However, I was able to get the same results selecting a plain old varchar column. Can also get this result with "SELECT PeopleID, Lastname, Email, '' " (and adding a fourth parameter to bind_columns). Removing the bind_columns statement and doing this instead while ( ($PeopleID, $Lastname, $Email) = $sth->fetchrow ) { # print something } works as expected. Also works properly doing fetchall_arrayref and stepping through the returned data structure. Is anybody else familiar with this behavior of fetchrow? ================================================= Michael Boudreau Senior Electronic Publishing Developer The University of Chicago Press 1427 E. 60th Street Chicago, IL 60637-2954 phone: 773 753 3298 fax: 773 753 3383 ================================================= --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php