Results 1 to 8 of 8

Thread: mySQL_Data_Seek ?!?!

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2003
    Posts
    3

    mySQL_Data_Seek ?!?!

    Warning: mysql_data_seek(): Offset 0 is invalid for MySQL result index 32 (or the query data is unbuffered) in admin/db_mysql.php on line 187
    Any Suggestions On What I Should Do?

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629
    maybe you should try posting line 187 and the lines around it
    Like Archer? Check out some Sterling Archer quotes.

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2003
    Posts
    3
    I'm Not Too Familiar w/ It All.

    But Here's The Actual File Itself.

    <~ Dazed & Confused
    Attached Files Attached Files

  4. #4
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629
    I'm guessing this is what you're having problems with, and it would've been easier to just have given me it instead of the whole script.

    PHP Code:
      function data_seek($pos,$query_id=-1) {
        
    // goes to row $pos
        
    if ($query_id!=-1) {
          
    $this->query_id=$query_id;
        }
        return 
    mysql_data_seek($this->query_id$pos);
      } 
    Well, I think PHP is telling you that there is no position below 0? I'm not sure, but maybe you should default $query_id to '0' or '1' instead of '-1', and I'm guessing '1' would be better because MySQL gives you the error of 0 being invalid.. never used mysql_data_seek() before, so you might try changing it altogether to something like:

    PHP Code:
      function data_seek($pos$query_id=1) { //changed "=-1" to "=1"
        // goes to row $pos
        
    if ($query_id 1) { //changed "!=-1" to "> 1"
          
    $this->query_id=$query_id;
        }
        return 
    mysql_data_seek($this->query_id$pos);
      } 
    edit: If $query_id is below 1, well, won't $this->query_id be undefined? Maybe you should just change it to "if($query_id > 0)", or get rid of the if statement altogether or something..
    Last edited by kows; Oct 23rd, 2003 at 06:49 PM.
    Like Archer? Check out some Sterling Archer quotes.

  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2003
    Posts
    3
    Warning: mysql_data_seek(): Offset 0 is invalid for MySQL result index 31 (or the query data is unbuffered) in admin/db_mysql.php on line 187

    Anyway I Can Log-In To PHPMyAdmin And Fix This?

    Like Buffer It Or Something... I'm So Lost It's Sad...

    ~1~

    P.S. I Really Appreciate The Help!!

  6. #6
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    The second parameter of mysql_data_seek() says which row number you would like to go to. There are no rows below 0. So -1 is invalid. You need to default to 0.

    The second argument is valid for 0 to mysql_num_rows() - 1.

    So as kows has already stated, you must change the number you are defaulting to.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  7. #7
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Scratch that. Your code is screwing up the FIRST parameter of mysql_data_seek(). The first parameter should be a resource identifier, NOT an integer.

    Where did you get this code from?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  8. #8
    Addicted Member Phenix's Avatar
    Join Date
    Sep 2002
    Location
    Near A Cube
    Posts
    228

    Thumbs up

    "It is perfectly possible for a query to succeed but affect no rows or return no rows." So make sure that there are rows before you try to seek to a specific row. I would suggest testing if your num_rows or mysql_num_rows is > 0 in your function query at line 97 before passing around a bad $this->query_id.
    Code:
         if (!$this->query_id) {
          $this->halt("Invalid SQL: ".$query_string);
        }
    //this line
        $query_count++;.
    Your other functions sometimes default to using the already set $this->query_id, so that had better be valid. You might also want to reconsider if you need to be passing around a query_id in the first place. Each object looks like it would keep its own query_id based on the query_string passed to function query (unless you are asking object A to give the results of the query performed by object B).
    Circa 1995
    Engineer - I think we should put our website address on our paper catalogs.
    Vice President - Don't get too excited about this internet thing.


    I am sorry, but the Oracle was mistaken. You cannot help us.
    -Matrix video game


    I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. ... and it probably never will support anything other than AT-harddisks, as that's all I have :-(.
    -Linus


    Question. Do you know that the character "?" means I'm asking a question? Question. Do you know that spoken inflection also provides the same cue? So please don't say, "Question" before you ask your question. Believe me I'll know.

    That said, I would have said this first if it had to precede what I'm telling you now. Having said that, what I'm telling you now is the same thing I just said about the annoying phrases "That said" and "Having said that".


    Are you threatening me, Master Jedi?
    -Chancellor Palpatine

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width