hi

I have 30 links stored in a table(mysql) now. I wanna show them accorging to
the traffic they send. But i don't want to list all of them in just 1 page
because i will be adding 300 links soon. (I don't want my visitors to wait 3
minutes to load the links)How should i do it? I wanna do it like this
http://mydomain.com/links?list=0
shows only links from 0-15
and
http://mydomain.com/links?list=15
shows links from 15-30
etc.

here is my code.
------
<?php

$connection = mysql_connect("localhost","","");
if ($connection==false)
{ 
echo mysql_errno().":".mysql_error().""; 
exit; 
} 
$query = "SELECT * FROM refer ORDER BY hits desc "; 
$result = mysql_db_query ("celebzone", $query); 

$rows = mysql_num_rows($result); 
$num_of_page = floor($rows/15)+1; 

$i=$list; 

for ($i = $list; $i < $list+15; $i++) 
{ 

if ($i <= $rows) 
{ 
@$id = mysql_result($result, $i, "id"); // check this later 
@$title = mysql_result($result, $i, "title"); // check this later 
echo "<a href=\"http://www.celebritieszones.com/jump.php?id=$id\">$title</a><br>\n"; 

} 
else 
{ 
echo "<!-- Cute Celebrities Links -->"; 
$i = 288; // this forces it to quit the loop 

} 
} 
echo "<br>"; 

$check = floor($rows/$num_of_page); // this finds how many pages it should generate 
if ( $check>0 ) 
{ 

if (($i-1)==288) 
{ 
echo "<!-- Cute Celebrities Links !-->"; 
} 
else 
{ 
$num_of_page = $i; 
echo "<a 
href=\"http://www.celebritieszones.com/links/index.php?list=$num_of_page\">Next Link 
Page</a>"; 
} 

} 
?> 
------- 
It's not good though and it's kinda stupid. :( When it loads the last page of my 
links, it will show this 
"Warning: Unable to jump to row 48 on MySQL result index 2 in 
/home/sites/site3/web/links/index.php on line 22 

Warning: Unable to jump to row 48 on MySQL result index 2 in 
/home/sites/site3/web/links/index.php on line 23" 

You see the @? I am using it to supress the error messasges cuz i don't know how to 
fix this error. Please help. :) 
Thank You. 









-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to