Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Warning: mysql_data_seek(): Offset 0 is invalid for MySQL

Status
Not open for further replies.

RobHudson

Programmer
Apr 30, 2001
172
0
0
GB
Hi all!

I'm getting the following message:
"Warning: mysql_data_seek(): Offset 0 is invalid for MySQL result index 7 (or the query data is unbuffered)"
when using mysql_data_seek.

I am calling the result by using mysql_query.
I am not using unbuffered query data - as far as I know anyway!

Any ideas?

Cheers
Rob
 
Here's what I found looking through the mysql manual:
--------------------------------------------------------
18.2.3.9. mysql_data_seek()
void mysql_data_seek(MYSQL_RES *result, my_ulonglong offset)

Description

Seeks to an arbitrary row in a query result set. The offset value is a row number and should be in the range from 0 to mysql_num_rows(result)-1.

This function requires that the result set structure contains the entire result of the query, so mysql_data_seek() may be used only in conjunction with mysql_store_result(), not with mysql_use_result().
--------------------------------------------------------
This is from the C API section *note that a lot of the api's here are also doubled in PHP*. So either your code calling it somewhere without the second parameter or another application is calling it without the second parameter.
But I agree with Sleipnir, if you can post the code, it would be really helpful.
 
Sorry, here's some code...

$SQL and $connection are both valida and needless to say the SQL is a SELECT.
formatMySQLDate returns are formatted date string.
It works when I test it on my local installation of windows xp/iis.

Code:
$result = mysql_query($SQL, $connection);
$row = mysql_fetch_array($result);
$out["StartDate"] = formatMySQLDate($row["usercourse_datestarted"]);
$out["FinishDate"] = formatMySQLDate($row["usercourse_datefinish"]);
$out["CourseName"] = htmlspecialchars(stripslashes($row["course_name"]));
mysql_data_seek($result, 0);

As you can see, not doing anything special...
I am not using mysql_store_result() or mysql_use_result() anywhere in the entire site.

Thanks so far!
Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top