hi

i ahve developed one artcicle submit site. in taht i have done list of authors and the number of article submitted by them.
but in the first page taht is fine but in second page onwards the number of article shows 0.
i cna show the website
http://articlenetworks.com/authors.php

this is my code

<?
$db=mysql_connect($hostname, $username, $passwd) or die ("could not connect to database sorry");
$sel=mysql_select_db("test") or die("nop");
// by default we show first page 
$pageNum = 1; 

// if $_GET['page'] defined, use it as page number 
if(isset($_GET['page'])) 
{ 
    $pageNum = $_GET['page']; 
} 
$rowsPerPage = 25; 

// counting the offset 
$offset = ($pageNum - 1) * $rowsPerPage; 
$c=mysql_query("select DISTINCT(name) from subart order by name ")or die("n");
$num=mysql_num_rows($c);
$i=0;
while($i<$num)
{
$authors=mysql_result($c,$i,"name");




$d=mysql_query("select * from subart where name='$authors'  limit $offset, $rowsPerPage ");
$n=mysql_num_rows($d);

// how many rows we have in database 
$query   = "SELECT COUNT(name) AS numrows FROM subart order by name ";
$result  = mysql_query($query) or die('Error, query failed'); 
$row     = mysql_fetch_array($result, MYSQL_ASSOC); 
$numrows = $row['numrows']; 
$r=COUNT($result);


// how many pages we have when using paging? 
$maxPage = ceil($numrows/$rowsPerPage); 

// print the link to access each page 
$self='authors.php'; 
$nav = ''; 
for($page = 1; $page <= $maxPage; $page++) 
{ 
    if ($page == $pageNum) 
    { 
        $nav .= " <font color=blue>$page </font>";   // no need to create a link to current page 
    } 
    else 
    { 
        $nav .= " <a href=\"$self?page=$page&$n\">$page</a> "; 
    }         
} 

// creating previous and next link 
// plus the link to go straight to 
// the first and last page 


if ($pageNum > 1) 
{ 
    $page = $pageNum - 1; 
    $prev = " <a href=\"$self?page=$page\"><font size=2 color=blue>Prev</a></b> "; 

    $first = " <a href=\"$self?page=1\"><font size=2 color=blue>First Page</a> "; 
}  
else 
{ 
    $prev  = '&nbsp;'; // we're on page one, don't print previous link 
    $first = '&nbsp;'; // nor the first page link 
} 

if ($pageNum < $maxPage) 
{ 
    $page = $pageNum + 1; 
    $next = " <a href=\"$self?page=$page&name=\"><font size=2 color=red>Next</a> "; 

    $last = " <a href=\"$self?page=$maxPage&$n\"><font size=2 color=blue>Last Page</a> "; 
}  
else 
{ 
    $next = '&nbsp;'; // we're on the last page, don't print next link 
    $last = '&nbsp;'; // nor the last page link 
} 




//print "<style=color:green>";


?>



</td></tr><tr><td><br></td></tr><tr><td align="left" width="50%">

<li><a href="expert.php?name=<?echo $authors?>"><?echo $authors?></a><td align="left" width="50%"><?echo $n?></td></li><b><font color="red">

<?
$i++;
}echo $nav; echo   $next;?>

any body can help me?

could you please format that with "code" tags. I get a headache just trying to read it.

could you please format that with "code" tags. I get a headache just trying to read it.

//the code is
<?database connection ;

// how many rows we have in database

$query = "SELECT COUNT(name) AS numrows FROM subart order by name ";
$result = mysql_query($query) or die('Error, query failed'); 
$row = mysql_fetch_array($result, MYSQL_ASSOC); 
$numrows = $row['numrows']; 
$r=COUNT($result);

// how many pages we have when using paging?

$maxPage = ceil($numrows/$rowsPerPage); 

[B]// print the link to access each page [/B] 
$self='authors.php'; 
$nav = ''; 
for($page = 1; $page <= $maxPage; $page++) 
{ 
if ($page == $pageNum) 
{ 
$nav .= " <font color=blue>$page </font>"; // no need to create a link to current page 
} 
else 
{ 
$nav .= " <a href=\"$self?page=$page&$n\">$page</a> "; 
} 
} 

[B]// creating previous and next link 
// plus the link to go straight to 
// the first and last page [/B] 

if ($pageNum > 1) 
{ 
$page = $pageNum - 1; 
$prev = " <a href=\"$self?page=$page\"><font size=2 color=blue>Prev</a></b> "; 

$first = " <a href=\"$self?page=1\"><font size=2 color=blue>First Page</a> "; 
} 
else 
{ 
$prev = '&nbsp;'; // we're on page one, don't print previous link 
$first = '&nbsp;'; // nor the first page link 
} 

if ($pageNum < $maxPage) 
{ 
$page = $pageNum + 1; 
$next = " <a href=\"$self?page=$page&name=\"><font size=2 color=red>Next</a> "; 

$last = " <a href=\"$self?page=$maxPage&$n\"><font size=2 color=blue>Last Page</a> "; 
} 
else 
{ 
$next = '&nbsp;'; // we're on the last page, don't print next link 
$last = '&nbsp;'; // nor the last page link

//display of the page

<tr><td align="left" width="50%">

<li><a href="expert.php?name=<?echo $authors?>"><?echo $authors?></a><td align="left" width="50%"><?echo $n?></td></li><b><font color="red">

<?
$i++;
}echo $nav; echo $next;?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.