Re: [PHP] Unbuffered Query
I think mysql_data_seek throws this warning also if there is no data in the result object at all, so I would check the result before positioning greets Zoltán Németh 2007. 01. 12, péntek keltezéssel 23.30-kor Richard Lynch ezt írta: > I have this process that dumps out database records to static HTML pages. > > The basic algorithm goes like: > > //Set any un-parented item (a root in the thread) to be its own parent: > update entry set original_id = entry_id where original_id is null > > //collect any "dirty" entries (changed in db, need to re-publish) > $dirty = select entry_id from entry where dirty = 1 > > while (list($entry_id) = mysql_fetch_row($dirty)){ > //find the whole thread: > $followups = select entry_id, X, Y from entry where original_id = > $dirty_id > //there is an ORDER BY which is not relevant > > //get some thread metadata from the first row's X field > list($junk, $X) = mysql_fetch_row($followups); > //$X is the same for all rows... > echo "$X\n"; > > //reset to row 0 > mysql_data_seek($followups, 0); > while (list($entry_id, $X, $Y) = mysql_fetch_row($followups)){ > echo "$Y\n"; > } > } > > So, how come *SOMETIMES*, seemingly at random, I get: > > Warning: mysql_data_seek(): Offset 0 is invalid for MySQL result index > 116 (or the > query data is unbuffered) in > /www/acousticdemo.com/web/complaints/publish.cron on > line 26 > > Line 26 is, obviously, the mysql_data_seek call above... > > I do not *THINK* there is any other process anywhere deleting rows > from the table -- it should be an ever-growing table... > > So is the query data being unbuffered out from under me due to some > my.cnf setting?... > > Or am I just plain wrong, and *something* is deleting from the entry > table? > > I Googled for the error message, and found about a 26,000 web sites > that are exhibiting this error, rather than the folks discussing this > error. :-v > > The few I was able to weed out were obvious logic errors, which I > don't think I have. > > I've read the mysql_unbuffered_query on php.net and think I understand > it in respect to mysql_query et al. > > I guess I'm looking for reassurance that it's definitely my mistake > somewhere in the mess I've made, and that I'm looking for a delete > query, and it's not a subtle bug or feature I'm failing to understand. > > :-) > > -- > Some people have a "gift" link here. > Know what I want? > I want you to buy a CD from some starving artist. > http://cdbaby.com/browse/from/lynch > Yeah, I get a buck. So? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unbuffered Query
# [EMAIL PROTECTED] / 2007-01-12 23:30:15 -0600: > Warning: mysql_data_seek(): Offset 0 is invalid for MySQL result index > 116 (or the > query data is unbuffered) in > /www/acousticdemo.com/web/complaints/publish.cron on > line 26 http://www.php.net/manual/en/function.mysql-unbuffered-query.php: You cannot use mysql_num_rows() and mysql_data_seek() on a result set returned from mysql_unbuffered_query(). -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unbuffered Query
Richard Lynch wrote: I have this process that dumps out database records to static HTML pages. The basic algorithm goes like: //Set any un-parented item (a root in the thread) to be its own parent: update entry set original_id = entry_id where original_id is null in the following you are looking for dirty flagged rows, were they set to dirty before or after your previous statement? //collect any "dirty" entries (changed in db, need to re-publish) $dirty = select entry_id from entry where dirty = 1 while (list($entry_id) = mysql_fetch_row($dirty)){ //find the whole thread: $followups = select entry_id, X, Y from entry where original_id = $dirty_id are you really meaning to use $dirty_id, or did you mean to use $entry_id??? $dirty_id doesn't exist as far as I can tell. unless it is something that was set before all this. //there is an ORDER BY which is not relevant Personally, I would do some check right here to see if the result set has at least one row at this point and then issue a continue; if mysql_num_rows() returns 0. That way you won't get empty h? tags floating around. //get some thread metadata from the first row's X field list($junk, $X) = mysql_fetch_row($followups); //$X is the same for all rows... echo "$X\n"; I would check your HTML output for empty tags, this would tell you that it didn't find anything :( Hope this helps Jim Lucas //reset to row 0 mysql_data_seek($followups, 0); while (list($entry_id, $X, $Y) = mysql_fetch_row($followups)){ echo "$Y\n"; } } So, how come *SOMETIMES*, seemingly at random, I get: Warning: mysql_data_seek(): Offset 0 is invalid for MySQL result index 116 (or the query data is unbuffered) in /www/acousticdemo.com/web/complaints/publish.cron on line 26 Line 26 is, obviously, the mysql_data_seek call above... I do not *THINK* there is any other process anywhere deleting rows from the table -- it should be an ever-growing table... So is the query data being unbuffered out from under me due to some my.cnf setting?... Or am I just plain wrong, and *something* is deleting from the entry table? I Googled for the error message, and found about a 26,000 web sites that are exhibiting this error, rather than the folks discussing this error. :-v The few I was able to weed out were obvious logic errors, which I don't think I have. I've read the mysql_unbuffered_query on php.net and think I understand it in respect to mysql_query et al. I guess I'm looking for reassurance that it's definitely my mistake somewhere in the mess I've made, and that I'm looking for a delete query, and it's not a subtle bug or feature I'm failing to understand. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Unbuffered Query
I have this process that dumps out database records to static HTML pages. The basic algorithm goes like: //Set any un-parented item (a root in the thread) to be its own parent: update entry set original_id = entry_id where original_id is null //collect any "dirty" entries (changed in db, need to re-publish) $dirty = select entry_id from entry where dirty = 1 while (list($entry_id) = mysql_fetch_row($dirty)){ //find the whole thread: $followups = select entry_id, X, Y from entry where original_id = $dirty_id //there is an ORDER BY which is not relevant //get some thread metadata from the first row's X field list($junk, $X) = mysql_fetch_row($followups); //$X is the same for all rows... echo "$X\n"; //reset to row 0 mysql_data_seek($followups, 0); while (list($entry_id, $X, $Y) = mysql_fetch_row($followups)){ echo "$Y\n"; } } So, how come *SOMETIMES*, seemingly at random, I get: Warning: mysql_data_seek(): Offset 0 is invalid for MySQL result index 116 (or the query data is unbuffered) in /www/acousticdemo.com/web/complaints/publish.cron on line 26 Line 26 is, obviously, the mysql_data_seek call above... I do not *THINK* there is any other process anywhere deleting rows from the table -- it should be an ever-growing table... So is the query data being unbuffered out from under me due to some my.cnf setting?... Or am I just plain wrong, and *something* is deleting from the entry table? I Googled for the error message, and found about a 26,000 web sites that are exhibiting this error, rather than the folks discussing this error. :-v The few I was able to weed out were obvious logic errors, which I don't think I have. I've read the mysql_unbuffered_query on php.net and think I understand it in respect to mysql_query et al. I guess I'm looking for reassurance that it's definitely my mistake somewhere in the mess I've made, and that I'm looking for a delete query, and it's not a subtle bug or feature I'm failing to understand. :-) -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php