Page 1 of 1

Beginner: I need code debug (I don't understand the problem)

Posted: Thu Feb 03, 2011 6:42 am
by alryaz
I always get errors in the code at http://pastebin.com/4DyhFSmB

The following errors are:
Warning: mysql_result() [function.mysql-result]: Unable to jump to row 11 on MySQL result index 4 in C:\xampp\htdocs\MySQL_Site\product_page.php on line 64

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 11 on MySQL result index 4 in C:\xampp\htdocs\MySQL_Site\product_page.php on line 65

Warning: mysql_result() [function.mysql-result]: Unable to jump to row 11 on MySQL result index 4 in C:\xampp\htdocs\MySQL_Site\product_page.php on line 66

Notice: Undefined variable: first in C:\xampp\htdocs\MySQL_Site\product_page.php on line 68

Notice: Undefined variable: last in C:\xampp\htdocs\MySQL_Site\product_page.php on line 68



What is the damn problem?

P.S.: I want PHP to output vars name, price, avail and many others to a line at 'echo' part using id (.../ppage.php?id=11 for ex.)
P.P.S.: I don't really care about errors with first and last vars

Re: Beginner: I need code debug (I don't understand the prob

Posted: Thu Feb 03, 2011 7:03 am
by Darhazer
I believe mysql_close() should be called after the while loop :)

Re: Beginner: I need code debug (I don't understand the prob

Posted: Thu Feb 03, 2011 7:13 am
by alryaz
Heh, thanks, but none of the problems look different nor did disappear. I guess I just try checking what type of variables, numerical or strings, are present. Also I got a code from the previous post which I am modyfying to suit my needs, it looks quite different from the code I have.

Re: Beginner: I need code debug (I don't understand the prob

Posted: Thu Feb 03, 2011 7:25 am
by divedj
Check line 51 in your code.

$var = mysql_numrows();

should be

$var = mysql_num_rows();

Re: Beginner: I need code debug (I don't understand the prob

Posted: Fri Feb 04, 2011 2:24 am
by Darhazer
divedj wrote:Check line 51 in your code.

$var = mysql_numrows();

should be

$var = mysql_num_rows();
Yeah, but mysql_numrows is a deprecated alias of mysql_num_rows and if it didn't exists, the script would die with fatal error - call to undefined function :)