I have a web page that shows data from two Database tables. The user can filter the results with three options which are. 'View by Region' , 'View by by Agent' and 'View all'. From what I have developed so far the 'View by Region' and 'View by by Agent' options (filters) are working but I can not get the the 'View all' option to work. I would also like the 'All' data to be shown by default when the page loads. I have used 'Dreamweaver' 'Server Behaviours' to build the code which I have tweaked with the basic knowledge I have.
SQL/PHP
$varAll_rsRTMs = "-1";
if (isset($_GET['property'])) {
$varAll_rsRTMs = $_GET['property'];
}
$varCounty_rsRTMs = "Berkshire";
if (isset($_GET['county'])) {
$varCounty_rsRTMs = $_GET['county'];
}
$varAgent_rsRTMs = "-1";
if (isset($_GET['agent'])) {
$varAgent_rsRTMs = $_GET['agent'];
}
mysql_select_db($database_Testing_server, $Testing_server);
$query_rsRTMs = sprintf("SELECT properties.property_id,properties.property_name, properties.address,
properties.town_city, properties.county, properties.`size`, properties.type, properties.acquisition, properties.image, properties.agent_id, properties.alt_tag, properties.title_tag, agents.agent_id, agents.name, agents.url FROM properties INNER JOIN agents ON properties.agent_id = agents.agent_id WHERE (properties.property_id <> %s) AND (properties.county = %s OR agents.agent_id = %s) ORDER BY properties.acquisition ASC", GetSQLValueString($varAll_rsRTMs, "int"),GetSQLValueString($varCounty_rsRTMs, "text"),GetSQLValueString($varAgent_rsRTMs, "int"));
$rsRTMs = mysql_query($query_rsRTMs, $Testing_server) or die(mysql_error());
$row_rsRTMs = mysql_fetch_assoc($rsRTMs);
$totalRows_rsRTMs = mysql_num_rows($rsRTMs);
HTML
<a href="right-to-manage-success.php?property=0">View All</a>
<a href="right-to-manage-success.php?county=<?php echo $row_rsCounty['county']; ?>"><?php echo $row_rsCounty['county']; ?></a>
<a href="right-to-manage-success.php?agent=<?php echo $row_rsAgents['agent_id']; ?>"><?php echo $row_rsAgents['name']; ?></a>
I have currently got a default value of "Berkshire" for the 'county' variable just so that something is shown when the page loads. But as I said ideally I would like all 'Properties' (data) to be shown as default.
Thanks in advance!