<?PHP include "./Ads.php"?>





Home Upload Ads Login Register Upload Ads
Company Type
HotellRestaurangVandrarhenPubarDiskotekCaféerSpaKonferens
kommun
<?
// connect to the database and query it to show the titles of all the threads,
// and the date when the thread was last posted
$kommun=$_POST['kommun'];
$companytype=$_POST['companytype'];
if(!$kommun)
{
echo "No selection was made";
exit;
}
$rowsPerPage =20;
// by default we show first page
$pageNum = 1;
// if $_GET['page'] defined, use it as page number
if(isset($_GET['page']))
{
$pageNum = $_GET['page'];
}
// counting the offset
$offset = ($pageNum - 1) * $rowsPerPage;
$query = "SELECT companytype,companyname,address,telephone FROM addreg where kommun like '$kommun' AND companytype like '$companytype' LIMIT $offset, $rowsPerPage";
$result = mysql_query($query) or die('Error, query failed');
// print the random numbers
while($row = mysql_fetch_array($result))
{
echo "Companytype : " .$row['companytype'] . '
';
echo "Companyname : " .$row['companyname'] . '
';
echo "Address : " .$row['address'] . '
';
echo "Telephone : " .$row['telephone'] . '
';
echo "
"."
";
}
echo '
';
// how many rows we have in database
$query = "SELECT COUNT(companyname) AS numrows FROM addreg where kommun like'$kommun' AND companytype like '$companytype'";
$result = mysql_query($query) or die('Error, query failed');
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$numrows = $row['numrows'];
// how many pages we have when using paging?
$maxPage = ceil($numrows/$rowsPerPage);
// print the link to access each page
$self = $_SERVER['PHP_SELF'];
$nav = '';
for($page = 1; $page <= $maxPage; $page++)
{
if ($page == $pageNum)
{
$nav .= " $page "; // no need to create a link to current page
}
else
{
$nav .= " $page ";
}
}
// creating previous and next link
// plus the link to go straight to
// the first and last page
if ($pageNum > 1)
{
$page = $pageNum - 1;
$prev = " [Prev] ";
$first = " [First Page] ";
}
else
{
$prev = ' '; // we're on page one, don't print previous link
$first = ' '; // nor the first page link
}
if ($pageNum < $maxPage)
{
$page = $pageNum + 1;
$next = " [Next] ";
$last = " [Last Page] ";
}
else
{
$next = ' '; // we're on the last page, don't print next link
$last = ' '; // nor the last page link
}
// print the navigation link
echo $first . $prev . $nav . $next . $last;
// and close the database connection
include '../library/closedb.php';
?>
footer