Jump to content


Photo

mysql_data_seek problem


  • Please log in to reply
No replies to this topic

#1 DesrtHawk

DesrtHawk
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 31 March 2006 - 11:49 AM

Hey,

I'm trying to make login script that will check username and password from user form to data in the database. I'm using one of my classes to work with the mysql database and today for first time I met strange error that I have never seen:
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
Warning: mysql_data_seek() [function.mysql-data-seek]: Offset 0 is invalid for MySQL result index 7 (or the query data is unbuffered) in ***\dbclass.php on line 207

Warning: mysql_data_seek() [function.mysql-data-seek]: Offset 0 is invalid for MySQL result index 7 (or the query data is unbuffered) in ***\dbclass.php on line 220[/quote]

Both lines contain data_seek function:
mysql_data_seek($result, 0);

And here is the code:
            $result = mysql_query ($query) or
                                die ("<b>Query failed (function do_query: $query)</b><br />");

            if ( preg_match("/^SELECT/i", $query) ) {
                            $rows = mysql_num_rows($result);
                            $this->numfields = mysql_num_fields ($result);
                                mysql_data_seek($result, 0);

                                $i = 0;
                                while ($i < $this->numfields) {
                                        $currField = mysql_fetch_field($result, $i);
                                        $this->fields[$i] = $currField->name;
                                        $i++;
                                }
                                mysql_data_seek($result, 0);
            }

The query still works, but I want to know why I get this warning and how to fix it.

Thanks in advance!

EDIT

Nevermind, I found the problem, I had wrond query syntax, strange I haven't seen it before :P




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users