if (!$letter)
{
$letter = "a";
}
function showindex_sql($sql)
{
$result = mysql_query($sql);
if (!$result)
die("SQL result failed");
$html = "";
$i = 0;
while ($row = mysql_fetch_array($result))
{
$lid = $row["link_id"];
$product = $row["link_name"];
$version = $row["cust7"];
$license = $row["cust1"];
$downloads = $row["link_hits"];
$downloads = number_format($downloads);
$featured = $row["link_pick"];
$fproduct = ereg_replace(' ','_',$product);
$fproduct = ereg_replace('\'','',$fproduct);
$count = $i + 1;
if ($featured == '1')
{
$featured = "
FEATURED";
}
else
{
$featured = "";
}
$html .= "
| $product $version $featured |
$license |
$downloads |
";
}
return $html;
}
$numrows = mysql_num_rows(mysql_query("select * from inl_links where link_name LIKE '$letter%'"));
if ($numrows == 0)
{
echo "
There are no products that begin with that character";
}
$limit=25; // rows to return
if (!$offset)
$offset = 0;
$showindex_sql = "SELECT * FROM inl_links LEFT JOIN inl_custom ON inl_links.link_cust=inl_custom.cust_id LEFT JOIN inl_users ON inl_links.link_user=inl_users.user_id WHERE link_name LIKE '$letter%' ORDER BY link_name limit $offset,$limit";
$links = showindex_sql($showindex_sql);
if (!$links)
{
echo "Nothing to show, please go back";
}
else
{
echo "
";
if ($letter == 'a') echo "A"; else echo "A";
echo "-";
if ($letter == 'b') echo "B"; else echo "B";
echo "-";
if ($letter == 'c') echo "C"; else echo "C";
echo "-";
if ($letter == 'd') echo "D"; else echo "D";
echo "-";
if ($letter == 'e') echo "E"; else echo "E";
echo "-";
if ($letter == 'f') echo "F"; else echo "F";
echo "-";
if ($letter == 'g') echo "G"; else echo "G";
echo "-";
if ($letter == 'h') echo "H"; else echo "H";
echo "-";
if ($letter == 'i') echo "I"; else echo "I";
echo "-";
if ($letter == 'j') echo "J"; else echo "J";
echo "-";
if ($letter == 'k') echo "K"; else echo "K";
echo "-";
if ($letter == 'l') echo "L"; else echo "L";
echo "-";
if ($letter == 'm') echo "M"; else echo "M";
echo "-";
if ($letter == 'n') echo "N"; else echo "N";
echo "-";
if ($letter == 'o') echo "O"; else echo "O";
echo "-";
if ($letter == 'p') echo "P"; else echo "P";
echo "-";
if ($letter == 'q') echo "Q"; else echo "Q";
echo "-";
if ($letter == 'r') echo "R"; else echo "R";
echo "-";
if ($letter == 's') echo "S"; else echo "S";
echo "-";
if ($letter == 't') echo "T"; else echo "T";
echo "-";
if ($letter == 'u') echo "U"; else echo "U";
echo "-";
if ($letter == 'v') echo "V"; else echo "V";
echo "-";
if ($letter == 'w') echo "W"; else echo "W";
echo "-";
if ($letter == 'x') echo "X"; else echo "X";
echo "-";
if ($letter == 'y') echo "Y"; else echo "Y";
echo "-";
if ($letter == 'z') echo "Z"; else echo "Z";
echo "
";
echo "
";
$numcounter = ($offset + 25);
if ($numcounter > $numrows)
{
$numcounter = $numrows;
}
echo "
Found $numrows titles starting with ($letter). Currently Showing $offset to $numcounter";
if ($offset != '0') { // bypass PREV link if offset is 0
$prevoffset=$offset-25;
print "PREV\n";
}
// calculate number of pages needing links
$pages=intval($numrows/$limit);
// $pages now contains int of pages needed unless there is a remainder from division
if ($numrows%$limit) {
// has remainder so add one page
$pages++;
}
for ($i=1;$i<=$pages;$i++) { // loop thru
$newoffset=$limit*($i-1);
print "$i\n";
}
// check to see if last page
if ($numcounter < $numrows) {
$newoffset=($offset+$limit);
{
echo "NEXT
\n";
}
print "";
}
?>
| Product |
License |
Downloads |
echo $links; ?>
} ?>
<%include:footer%>