Jump to content

Archived

This topic is now archived and is closed to further replies.

DesrtHawk

mysql_data_seek problem

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

Share this post


Link to post
Share on other sites

×

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.