Forums

This topic is locked

go to detail page with several filters

Posted 05 Mar 2012 08:00:28
1
has voted
05 Mar 2012 08:00:28 Vivian Eersels posted:
how can create a link to the detailpage using several filters?
I made a recordset on de listpage:

SELECT *
FROM tblAutoInternet
WHERE Cat3 = 'Lichte vrachtwagen' or Cat ='Lichte vrachtwagen' or Cat2='Lichte vrachtwagen'

go to detail page crate a link:
<a href="tweedehands.php?Cat=<?php echo $row_rsLichteVracht['Cat']; ?>">Lichte vrachtwagens</a>

but on this way, only cat is showing up in de detailpage (tweedehands.php)

The recordset in the detailpage:


<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$colname_RsAll = "-1";
if (isset($_GET['Cat'])) {
  $colname_RsAll = $_GET['Cat'];
}
$colname2_RsAll = "-1";
if (isset($_GET['Cat2'])) {
  $colname2_RsAll = $_GET['Cat2'];
}
$colname3_RsAll = "-1";
if (isset($_GET['Cat3'])) {
  $colname3_RsAll = $_GET['Cat3'];
}
mysql_select_db($database_Master, $Master);
$query_RsAll = sprintf("SELECT * FROM tblAutoInternet WHERE Cat = %s or Cat2 = %s or Cat3 = %s", GetSQLValueString($colname_RsAll, "text"),GetSQLValueString($colname2_RsAll, "text"),GetSQLValueString($colname3_RsAll, "text"));
$RsAll = mysql_query($query_RsAll, $Master) or die(mysql_error());
$row_RsAll = mysql_fetch_assoc($RsAll);
$totalRows_RsAll = mysql_num_rows($RsAll);


?>


How can I do that?

Reply to this topic