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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alryaz
Forum Newbie
Posts: 5
Joined: Thu Feb 03, 2011 4:42 am

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

Post 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
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

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

Post by Darhazer »

I believe mysql_close() should be called after the while loop :)
alryaz
Forum Newbie
Posts: 5
Joined: Thu Feb 03, 2011 4:42 am

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

Post 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.
divedj
Forum Commoner
Posts: 47
Joined: Wed Dec 29, 2010 4:32 am
Location: Malta

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

Post by divedj »

Check line 51 in your code.

$var = mysql_numrows();

should be

$var = mysql_num_rows();
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

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

Post 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 :)
Post Reply