Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jarv

macrumors newbie
Original poster
Jan 17, 2011
12
0
I need to be able to show a county list based on which county has been clicked

You can login at: http://www.mypubspace.com/iphone/pubs/default.php#___1__

user: test
pass: test

at the moment, Aberdeenshire is the only county that works

here is my code:

Code:
<?
$CountyName = filter_input(INPUT_GET, 'CountyName', FILTER_SANITIZE_STRING);

$offset = (isset($_GET['start'])) ? (int)$_GET["start"] : 0;
$rowsPerPage = (isset($_GET['count'])) ? (int)$_GET["count"] : 10; 
$query  = "SELECT * FROM pubs  WHERE rsCounty = 'Aberdeenshire' LIMIT $offset, $rowsPerPage";
$result = mysql_query($query) or die(mysql_error().'<br>SQL: ' . $query); 


//looping counties
$query1  = "SELECT rsCounty, COUNT(PUBID) AS County_Count FROM pubs GROUP BY rsCounty";
$result1 = mysql_query($query1) or die(mysql_error().'<br>SQL: ' . $query1);  
$County1 = $result1['rsCounty'];
$CountyCount = $result1['County_Count'];
?>
<div class="toolbar">
        <h1 id="pageTitle">Select County</h1>
        <a id="backButton" class="button" href="#"></a>
        <a class="button" href="logout.php" target="_self">Logout</a>
    </div>
	 <ul title="Select County" id="county" selected="true">
<?php
while ($row = mysql_fetch_assoc($result1)){
$RSCOUNTY1 = $row['rsCounty'];
$RSCOUNTY1short = substr($row['rsCounty'],0,4);
$CountyCount = $row['County_Count'];
echo <<<EOF
  <li><a href="$RSCOUNTY1" class="digg-count">$CountyCount</a>
  <a href="#$RSCOUNTY1">$RSCOUNTY1</a></li>
EOF;
}
echo "</ul>";

// start Aberdeenshire
echo "<ul title=\"Aberdeenshire\" id=\"Aberdeenshire\">";
while($row = mysql_fetch_array($result)){
$PUBID = $row['PUBID'];
$rsPubName = $row['rsPubName'];
$rsAddress = $row['rsAddress']; 
$rsPostCode = $row['rsPostCode'];
$rsTel = $row['rsTel'];
$rsTown = $row['rsTown'];
$rsCounty = $row['rsCounty'];
// how many rows we have in database
// print the link to access each page

$self = $_SERVER['PHP_SELF'];
$next = "<li><a href=\"all.php?start=" . ($offset + $rowsPerPage) . "&count={$rowsPerPage}\" target=\"_replace\">View More</a></li>";
//div container of header and information
echo <<<EOF
  <li><a href="viewpub.php?PUBID=$PUBID">$rsPubName</a></li>
EOF;
if	($_SESSION["RSUSER"] == "admin") 
{
echo "<a href=\"edit.php?PUBID=$PUBID\" class=\"small\">edit this pub</a>";
}
}
echo $next;
echo "</ul>";
// End Aberdeenshire
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.