我有一个显示两个数据库表中数据的网页。用户可以使用三个选项过滤结果。 '按地区查看' ,'按代理商查看'和'查看全部'。从我迄今为止开发的“按地区查看”#39;并且由代理人查看'选项(过滤器)正在运行,但我无法获得所有'查看全部'工作的选择。我也希望所有的'页面加载时默认显示的数据。我曾经使用过Dreamweaver' '服务器行为'构建我用我所掌握的基本知识调整过的代码。
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>
我目前的默认值为&#34; Berkshire&#34;为了县&#39;变量只是为了在页面加载时显示某些内容。但正如我所说,理想情况下,我希望所有的“物业”和“物业”。 (数据)显示为默认值。
提前致谢!