after I run this , it shows I have errors, I don't know why I have those error?By the way thanks a lot for reading the code!!🙂
here is the code( it is for creating next and previous page button) :
<?php
$user="llama";
$pass="osti";
$db="funpic";
$link=mysql_connect("localhost",$user,$pass);
if(!link)
die("couldn't connect MYSQL");
mysql_select_db($db,$link)or die("couldn't open $db:".mysql_error());
$rows_per_page=30;
if(!isset($screen))
$screen=0;
$start=$screen*$rows_per_page; //setting the start point of each page
$sql="SELECT filename FROM PicInfo";
$sql.="LIMIT $start,$rows_per_page";
$result=mysql_query($sql);
$total_records=mysql_num_rows($result); //the number of the links
$pages=ceil($total_records/$rows_per_page); // number of pages
mysql_free_result($result); //???????????
$rows=mysql_num_rows($result); //number of rows
for($i=0;$i<$rows;$i++){ //loop the links
$description=mysql_result($result,$i,0);
echo"\$description=$description<br>\n";
}
echo"<p><hr></p>\n";
//create a dynamic links
if($screen>0){
$url="example.php?screen=" . $screen-1;
echo"<a href=\"$url\">Previous</a>\n";
}
for($i=0;$i<$pages;$i++){
$url="example.php?screen=" .$i;
echo "|<a href=\"url\">$i</a>|";
}
if ($screen < $pages) {
$url = "example.php?screen=" . $screen + 1;
echo "<a href=\"$url\">Next</a>\n";
}
?>
The errors is here:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/llama/www/FunPicSite/PicLink2.php on line 18
Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /home/llama/www/FunPicSite/PicLink2.php on line 20
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/llama/www/FunPicSite/PicLink2.php on line 22
Thank you again!!🙂