![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
08/04/2014, 07:19
|
| | Fecha de Ingreso: enero-2012
Mensajes: 224
Antigüedad: 13 años Puntos: 1 | |
Respuesta: Problema para filtro php mysql hola la consulta me devuelve todos los campos con id ASC
es como que solo me toma esta parte de la consulta
$query_consulta = "SELECT * FROM reclamos ";
Código:
<?php
//initialize the session
session_start();
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
$logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
//to fully log out a visitor we need to clear the session varialbles
session_unregister('MM_Username');
session_unregister('MM_UserGroup');
$logoutGoTo = "../index.php";
if ($logoutGoTo) {
header("Location: $logoutGoTo");
exit;
}
}
?>
<?php
session_start();
$MM_authorizedUsers = "10, 20";
$MM_donotCheckaccess = "false";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && false) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "../index.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
$area = $_GET['area'];
$localidad = $_GET['localidad'];
$maxRows_consulta = 15;
$pageNum_consulta = 0;
if (isset($_GET['pageNum_consulta'])) {
$pageNum_consulta = $_GET['pageNum_consulta'];
}
$startRow_consulta = $pageNum_consulta * $maxRows_consulta;
mysql_select_db($database_localhost, $localhost);
$query_consulta = "SELECT * FROM reclamos ";
$conditions = array();
if($area !=""){
$conditions[] = " area = '$area' ";
}
if($localidad !=""){
$conditions[] = " localidad = '$localidad' ";
}
if( count( $conditions[''] ) > 0 ) {
$query_consulta .= " WHERE " . implode ( " AND ", $conditions)."ORDER BY id DESC" ; // = SELECT * FROM //
}
$query_limit_consulta = sprintf("%s LIMIT %d, %d", $query_consulta, $startRow_consulta, $maxRows_consulta);
$consulta = mysql_query($query_limit_consulta, $localhost) or die(mysql_error());
$row_consulta = mysql_fetch_assoc($consulta);
if (isset($_GET['totalRows_consulta'])) {
$totalRows_consulta = $_GET['totalRows_consulta'];
} else {
$all_consulta = mysql_query($query_consulta);
$totalRows_consulta = mysql_num_rows($all_consulta);
}
$totalPages_consulta = ceil($totalRows_consulta/$maxRows_consulta)-1;
$queryString_consulta = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_consulta") == false &&
stristr($param, "totalRows_consulta") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_consulta = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_consulta = sprintf("&totalRows_consulta=%d%s", $totalRows_consulta, $queryString_consulta);
?>
|