dongtan6206 2016-09-22 08:44
浏览 22

使用sql / PHP将所有数据显示为默认值

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!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何在炒股软件中,爬到我想看的日k线
    • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
    • ¥15 seatunnel 怎么配置Elasticsearch
    • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
    • ¥15 (标签-MATLAB|关键词-多址)
    • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
    • ¥500 52810做蓝牙接受端
    • ¥15 基于PLC的三轴机械手程序
    • ¥15 多址通信方式的抗噪声性能和系统容量对比
    • ¥15 winform的chart曲线生成时有凸起