Jump to content

simple filter not working- im doing something wrong


dflow

Recommended Posts

hi

 

im trying to get a Currency Symbol from my Currencies table

 

the main filtered table is city_list

i have a CurrencyID in the this table AND IT IS INDEXED

 

i want to GET CurrencyID from the city list and display the correct symbol

london= british pound

new york = US dollar

record sets:

<?php
$currentPage = $HTTP_SERVER_VARS["PHP_SELF"];

$maxRows_RsCityApartments = 7;
$pageNum_RsCityApartments = 0;
if (isset($HTTP_GET_VARS['pageNum_RsCityApartments'])) {
  $pageNum_RsCityApartments = $HTTP_GET_VARS['pageNum_RsCityApartments'];
}
$startRow_RsCityApartments = $pageNum_RsCityApartments * $maxRows_RsCityApartments;

$colname_RsCityApartments = "1";
if (isset($HTTP_GET_VARS['CityID'])) {
  $colname_RsCityApartments = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['CityID'] : addslashes($HTTP_GET_VARS['CityID']);
}
mysql_select_db($database_international, $international);
$query_RsCityApartments = sprintf("SELECT * FROM products WHERE CategoryID=2 AND CityID = %s AND LangHEB=1 ORDER BY products.UnitPrice", $colname_RsCityApartments);
$query_limit_RsCityApartments = sprintf("%s LIMIT %d, %d", $query_RsCityApartments, $startRow_RsCityApartments, $maxRows_RsCityApartments);
$RsCityApartments = mysql_query($query_limit_RsCityApartments, $international) or die(mysql_error());
$row_RsCityApartments = mysql_fetch_assoc($RsCityApartments);

if (isset($HTTP_GET_VARS['totalRows_RsCityApartments'])) {
  $totalRows_RsCityApartments = $HTTP_GET_VARS['totalRows_RsCityApartments'];
} else {
  $all_RsCityApartments = mysql_query($query_RsCityApartments);
  $totalRows_RsCityApartments = mysql_num_rows($all_RsCityApartments);
}
$totalPages_RsCityApartments = ceil($totalRows_RsCityApartments/$maxRows_RsCityApartments)-1;

$colname_RsCityLabel = "1";
if (isset($HTTP_GET_VARS['CityID'])) {
  $colname_RsCityLabel = $HTTP_GET_VARS['CityID'];
}
$CurrencyID_RsCityLabel = "1";
if (isset($GET['CurrencyID'])) {
  $CurrencyID_RsCityLabel = $GET['CurrencyID'];
}
mysql_select_db($database_international, $international);
$query_RsCityLabel = sprintf("SELECT * FROM city_list WHERE CityID = %s AND %s=%s", GetSQLValueString($colname_RsCityLabel, "int"),GetSQLValueString($CurrencyID_RsCityLabel, "int"),GetSQLValueString($CurrencyID_RsCityLabel, "int"));
$RsCityLabel = mysql_query($query_RsCityLabel, $international) or die(mysql_error());
$row_RsCityLabel = mysql_fetch_assoc($RsCityLabel);
$totalRows_RsCityLabel = mysql_num_rows($RsCityLabel);

$colname_RsCountryLabel = "-1";
if (isset($_GET['CountryID'])) {
  $colname_RsCountryLabel = $_GET['CountryID'];
}
mysql_select_db($database_international, $international);
$query_RsCountryLabel = sprintf("SELECT * FROM country_list WHERE CountryID = %s", GetSQLValueString($colname_RsCountryLabel, "int"));
$RsCountryLabel = mysql_query($query_RsCountryLabel, $international) or die(mysql_error());
$row_RsCountryLabel = mysql_fetch_assoc($RsCountryLabel);
$totalRows_RsCountryLabel = mysql_num_rows($RsCountryLabel);

mysql_select_db($database_international, $international);
$query_RsCurrency = "SELECT * FROM currencies ";
$RsCurrency = mysql_query($query_RsCurrency, $international) or die(mysql_error());
$row_RsCurrency = mysql_fetch_assoc($RsCurrency);
$totalRows_RsCurrency = mysql_num_rows($RsCurrency);

$queryString_RsCityApartments = "";
if (!empty($HTTP_SERVER_VARS['QUERY_STRING'])) {
  $params = explode("&", $HTTP_SERVER_VARS['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_RsCityApartments") == false && 
        stristr($param, "totalRows_RsCityApartments") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_RsCityApartments = "&" . implode("&", $newParams);
  }
}
$queryString_RsCityApartments = sprintf("&totalRows_RsCityApartments=%d%s", $totalRows_RsCityApartments, $queryString_RsCityApartments);
?>

 

thanks

 

simple but one gets stuck on these sometimes  8) ??? ;D

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.