我用php和mysql创建了一个显示包页面。桌子顶部有10个按钮可以重新过滤输出。我如何使用$_GET['command']
等于'AND lock_in_period = '1yr'
进行重新过滤。我试图在会话中保存$_GET['command']
,但它不起作用。现在的问题是我在重新过滤输出后无法获得最小贷款金额来排序asc或desc。
输出
mysql查询:
if($property_type_search == 'HDB'){
$find=mysql_query("SELECT*FROM package_creation WHERE property_type IN ('HDB','HDB,Private') $newcommand ORDER BY $columnname $order");
}
分钟贷款金额分拣按钮:
<a class="link_style" href="<?php echo $_SERVER['PHP_SELF']; ?>?command=<?php echo $_GET['command']?>&columnname= min_loan_amount&<?php if($_GET['sort']== "asc"){echo "sort=desc"; $_GET['sort']="asc";}elseif($_GET['sort']=="desc"){echo "sort=asc";$_GET['sort']="desc";}elseif($_GET['sort']==""){echo "sort=asc";}?>"><img src="images/arrow_sort.png"></a>
重新过滤按钮:
<?php
session_start();
if($_GET['FC']=='1'){
header("location:rates_results.php?command=AND lock_in_period = 'N.A' AND interest_rate_type IN ('Floating Rate(Sibor/Sor Rate)','Floating Rate(Sibor Rate)')");
}
if($_GET['FC']=='2'){
header("location:rates_results.php?command=AND lock_in_period = '1yr' AND interest_rate_type IN ('Floating Rate(Sibor/Sor Rate)','Floating Rate(Sibor Rate)')");
}
if($_GET['FC']=='3'){
header("location:rates_results.php?command=AND lock_in_period = '2yrs' AND interest_rate_type IN ('Floating Rate(Sibor/Sor Rate)','Floating Rate(Sibor Rate)')");
}
if($_GET['FC']=='4'){
header("location:rates_results.php?command=AND lock_in_period = '3yrs' AND interest_rate_type IN ('Floating Rate(Sibor/Sor Rate)','Floating Rate(Sibor Rate)')");
}
if($_GET['FC']=='5'){
header("location:rates_results.php?command=AND yrs_of_fixed_rate = '1yr' AND interest_rate_type = 'Fixed Rate'");
}
if($_GET['FC']=='6'){
header("location:rates_results.php?command=AND yrs_of_fixed_rate = '2yrs' AND interest_rate_type = 'Fixed Rate'");
}
if($_GET['FC']=='7'){
header("location:rates_results.php?command=AND yrs_of_fixed_rate = '3yrs' AND interest_rate_type = 'Fixed Rate'");
}
if($_GET['FC']=='8'){
header("location:rates_results.php?command=AND yrs_of_fixed_rate = '4yrs' AND interest_rate_type = 'Fixed Rate'");
}
if($_GET['FC']=='9'){
header("location:rates_results.php?command=AND yrs_of_fixed_rate = '5yrs' AND interest_rate_type = 'Fixed Rate'");
}
if($_GET['FC']=='10'){
header("location:rates_results.php?command=AND installation_mode IN ('Saving offset interest','Interest and Principle,Saving offset interest','Interest only, Saving offset interest','Interest and Principle,Interest only,Saving offset interest')");
}
?>
注入mysql查询:
$columnname ="";
if($_GET['columnname']){
$columnname = $_GET['columnname'];
}
if($columnname==""){
$columnname="first_year";
}
if($order==""){
$order = "desc";
}
$order=$_GET['sort'];
$newcommand = "";
if($_GET['command'] !=""){
$newcommand = $_GET['command'];
}
答案 0 :(得分:0)
检查此LOC -
command=$_GET['command'] and make it as command=<?php echo $_GET['command'] ?>