#32997 [Opn]: Warning for seeking to row 0

From: Date: Tue, 10 May 2005 09:34:49 +0000
Subject: #32997 [Opn]: Warning for seeking to row 0
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-78846@lists.php.net to get a copy of this message
ID: 32997 User updated by: olafvdspek at gmail dot com Reported By: olafvdspek at gmail dot com Status: Open Bug Type: MySQL related Operating System: Windows 2003 PHP Version: 5.0.4 New Comment: I see the documentation mentions this issue: > row_number starts at 0. The row_number should be a value in the range from 0 to mysql_num_rows() - 1. However if the result set is empty (mysql_num_rows() == 0), a seek to 0 will fail with a E_WARNING and mysql_data_seek() will return FALSE. Why does the seek not work like a normal fseek where you can also seek to the end of the file (after you've read the last byte)? Previous Comments: ------------------------------------------------------------------------ [2005-05-10 11:32:20] olafvdspek at gmail dot com Description: ------------ Hi, PHP emits a bogus warning when you seek to row 0 in an empty result set. Seeking to row 0 is a no-op in an empty set, but should not emit a warning. Reproduce code: --------------- <?php mysql_connect('localhost', 'xbt', ''); mysql_select_db('xbt'); $rows = mysql_query("select 1 from xbt_files where 0 = 1") or die(mysql_error()); mysql_data_seek($rows, 0); ?> Expected result: ---------------- No warning Actual result: -------------- Warning: mysql_data_seek() [function.mysql-data-seek]: Offset 0 is invalid for MySQL result index 3 (or the query data is unbuffered) in C:\IS\Apache2\htdocs\temp\data_seek.php on line 5 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32997&edit=1

« previous php.bugs (#78846) next »