|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32997 Warning for seeking to row 0
Submitted: 2005-05-10 11:32 UTC Modified: 2005-05-10 14:35 UTC
From: olafvdspek at gmail dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.0.4 OS: Windows 2003
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: olafvdspek at gmail dot com
New email:
PHP Version: OS:


 [2005-05-10 11:32 UTC] olafvdspek at gmail dot com

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:
	mysql_connect('localhost', '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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-10 11:34 UTC] olafvdspek at gmail dot com
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)?
 [2005-05-10 14:35 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Dec 06 20:01:27 2023 UTC