Jump to content

mysql_data_seek problem


DesrtHawk

Recommended Posts

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:
[code]mysql_data_seek($result, 0);[/code]

And here is the code:
[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);
            }
[/code]

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

Thanks in advance!

[b]EDIT[/b]

Nevermind, I found the problem, I had wrond query syntax, strange I haven't seen it before :P
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.