0

我用 php 和 mysql 创建了一个显示包页面。表格顶部有 10 个按钮用于重新过滤输出。我如何重新过滤器是使用$_GET['command']which is equal to ' 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']; 
}
4

1 回答 1

0

检查这个 LOC——

command=$_GET['command'] and make it as command=<?php echo $_GET['command'] ?>
于 2012-06-18T06:39:03.963 回答