Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/06/2009, 09:18
marianoear
 
Fecha de Ingreso: mayo-2009
Mensajes: 68
Antigüedad: 15 años
Puntos: 0
filtro con tres listas

Hola a todos, estoy haciendo un proyecto y necesito filtrar tres columnas de na misma tabla, lo hice con Dreamweaver pero el problemas es que en el tercer filtro de pierde la relación con el primero y solo me relaciona con el segundo... relamente no se como hacerlo...
les paso el codigo que tengo armado para que me puedan ayudar:


-------------------------


if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}
mysql_select_db($database_conexion, $conexion);
$query_facultad = "SELECT * FROM apuntes";
$facultad = mysql_query($query_facultad, $conexion) or die(mysql_error());
$row_facultad = mysql_fetch_assoc($facultad);
$totalRows_facultad = mysql_num_rows($facultad);
$colname_resultadofacultad = "-1";
if (isset($_GET['facultad'])) {
$colname_resultadofacultad = $_GET['facultad'];
}
mysql_select_db($database_conexion, $conexion);
$query_resultadofacultad = sprintf("SELECT * FROM apuntes WHERE facultad = %s", GetSQLValueString($colname_resultadofacultad, "text"));
$resultadofacultad = mysql_query($query_resultadofacultad, $conexion) or die(mysql_error());
$row_resultadofacultad = mysql_fetch_assoc($resultadofacultad);
$totalRows_resultadofacultad = mysql_num_rows($resultadofacultad);
$colname_resultadonombre = "-1";
if (isset($_GET['anio'])) {
$colname_resultadonombre = $_GET['anio'];
}
mysql_select_db($database_conexion, $conexion);
$query_resultadonombre = sprintf("SELECT * FROM apuntes WHERE anio = %s", GetSQLValueString($colname_resultadonombre, "text"));
$resultadonombre = mysql_query($query_resultadonombre, $conexion) or die(mysql_error());
$row_resultadonombre = mysql_fetch_assoc($resultadonombre);
$totalRows_resultadonombre = mysql_num_rows($resultadonombre);
$colname_resultado = "-1";
if (isset($_GET['nombre'])) {
$colname_resultado = $_GET['nombre'];
}
mysql_select_db($database_conexion, $conexion);
$query_resultado = sprintf("SELECT * FROM apuntes WHERE nombre = %s", GetSQLValueString($colname_resultado, "text"));
$resultado = mysql_query($query_resultado, $conexion) or die(mysql_error());
$row_resultado = mysql_fetch_assoc($resultado);
$totalRows_resultado = mysql_num_rows($resultado);
?>


-------------------------
Seguramente en la ultima consulta debería agregar una relación con la primera, ya busqué mucho pero sigo si entenderlo...
desde ya agradezco su colaboración...
Saludos.