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..
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.
"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