I'm really new to php and I am trying to learn it slowly. So far I have been able to create login/register scripts and can display my products all on one page. Now i want to split this page into several different pages, and Ive been using the following tutorial:
http://phpeasystep.com/phptu/29.html
In the last part where u enter your own while loop, i have:
Code: Select all
<?php
while($row = mysql_fetch_array($result))
{
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$product_name=mysql_result($result,$i,"product_name");
$product_line=mysql_result($result,$i,"product_line");
$product_description=mysql_result($result,$i,"product_description");
$image=mysql_result($result,$i,"image");
$price=mysql_result($result,$i,"price");
echo "<font color=\"white\"><u>$product_name</u></b><br><br>$product_line<br><br></font>";
echo "<img alt=\"product image\" width=\"250\" height=\"265\" src=\"images/".$image." \"/>";
echo "<font color=\"white\"></br><u>Product Description</u><br><br>$product_description<br><br>£$price<hr><br></font>";
$i++;
}
}
?>Then im getting these errors:
Code: Select all
Notice: Use of undefined constant num - assumed 'num' in C:\wamp\www\pagination.php on line 23
Notice: Undefined index: page in C:\wamp\www\pagination.php on line 28
Warning: mysql_result() [function.mysql-result]: product_name not found in MySQL result index 6 in C:\wamp\www\pagination.php on line 144
Warning: mysql_result() [function.mysql-result]: product_line not found in MySQL result index 6 in C:\wamp\www\pagination.php on line 145
Warning: mysql_result() [function.mysql-result]: product_description not found in MySQL result index 6 in C:\wamp\www\pagination.php on line 148
Warning: mysql_result() [function.mysql-result]: image not found in MySQL result index 6 in C:\wamp\www\pagination.php on line 150
Warning: mysql_result() [function.mysql-result]: price not found in MySQL result index 6 in C:\wamp\www\pagination.php on line 152
Can someone please tell me where im going wrong?
Many thanks for any help!!