Foros del Web » Programando para Internet » PHP »

resultado repetido

Estas en el tema de resultado repetido en el foro de PHP en Foros del Web. Hola, buenas tardes a todos!! He realizado (con la ayuda de ustedes) un buscador que me trae (por usuario y pass) un listado de numeros ...
  #1 (permalink)  
Antiguo 19/03/2008, 16:08
 
Fecha de Ingreso: febrero-2003
Mensajes: 37
Antigüedad: 21 años, 2 meses
Puntos: 0
Mensaje resultado repetido

Hola, buenas tardes a todos!!

He realizado (con la ayuda de ustedes) un buscador que me trae (por usuario y pass) un listado de numeros telefonicos, alli pico sobre el numero y me trae (correctamente) el detalle de cada linea. El problema es que en el listado sale todas las veces que se utilizo un numero, por ejemplo si el usuario pepe con clave 1234 tiene 5 numeros de telefono, me deberia salir una vez cada numero, y al picar sobre el numero correspondiente me saldria el detalle, en vez de eso me sale repetido el numero telefonico todas las veces que fue usado.. no se si es claro, adjunto el codigo a ver si pueden darme una ayuda.
Muchas gracias!!!

<?php require_once('Connections/orbitel.php'); ?>
<?php session_start(); ?>
<?php
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;
}
}

$userId = $_SESSION['userid'];


$currentPage = $_SERVER["PHP_SELF"];

$maxRows_rsBuscar = 15;
$pageNum_rsBuscar = 0;
if (isset($_GET['pageNum_rsBuscar'])) {
$pageNum_rsBuscar = $_GET['pageNum_rsBuscar'];
}
$startRow_rsBuscar = $pageNum_rsBuscar * $maxRows_rsBuscar;

$colname_rsBuscar = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_rsBuscar = $_SESSION['MM_Username'];
}
mysql_select_db($database_orbitel, $orbitel);
$query_rsBuscar = sprintf("SELECT * FROM cdr WHERE userid = %s ORDER BY src, start ASC", GetSQLValueString($colname_rsBuscar, "text"));
$query_limit_rsBuscar = sprintf("%s LIMIT %d, %d", $query_rsBuscar, $startRow_rsBuscar, $maxRows_rsBuscar);
$rsBuscar = mysql_query($query_limit_rsBuscar, $orbitel) or die(mysql_error());
$row_rsBuscar = mysql_fetch_assoc($rsBuscar);

if (isset($_GET['totalRows_rsBuscar'])) {
$totalRows_rsBuscar = $_GET['totalRows_rsBuscar'];
} else {
$all_rsBuscar = mysql_query($query_rsBuscar);
$totalRows_rsBuscar = mysql_num_rows($all_rsBuscar);
}
$totalPages_rsBuscar = ceil($totalRows_rsBuscar/$maxRows_rsBuscar)-1;

$colname_rsSumando = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_rsSumando = $_SESSION['MM_Username'];
}
mysql_select_db($database_orbitel, $orbitel);
$query_rsSumando = sprintf("SELECT sum(total_pvp) as resultado FROM cdr WHERE userid = %s", GetSQLValueString($colname_rsSumando, "text"));
/* $query_rsSumando = sprintf("SELECT sum(total_pvp) as resultado FROM cdr WHERE src = %s", GetSQLValueString($colname_rsSumando, "text")); */
$rsSumando = mysql_query($query_rsSumando, $orbitel) or die(mysql_error());
$row_rsSumando = mysql_fetch_assoc($rsSumando);
$totalRows_rsSumando = mysql_num_rows($rsSumando);

$colname_rsUsuario = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_rsUsuario = $_SESSION['MM_Username'];
}
mysql_select_db($database_orbitel, $orbitel);
$query_rsUsuario = sprintf("SELECT * FROM `user` WHERE userid = %s", GetSQLValueString($colname_rsUsuario, "text"));
$rsUsuario = mysql_query($query_rsUsuario, $orbitel) or die(mysql_error());
$row_rsUsuario = mysql_fetch_assoc($rsUsuario);
$totalRows_rsUsuario = mysql_num_rows($rsUsuario);

$queryString_rsBuscar = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_rsBuscar") == false &&
stristr($param, "totalRows_rsBuscar") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_rsBuscar = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_rsBuscar = sprintf("&totalRows_rsBuscar=%d%s", $totalRows_rsBuscar, $queryString_rsBuscar);

/************************************************** **********************************/
/* Devuelve una cadena con la fecha que se le manda como parámetro en formato largo */
/************************************************** **********************************/
function FechaFormateada2($FechaStamp)
{
$ano = date('Y',$FechaStamp);
$mes = date('n',$FechaStamp);
$dia = date('d',$FechaStamp);
$diasemana = date('w',$FechaStamp);

$diassemanaN= array("Domingo","Lunes","Martes","Miércoles","Juev es","Viernes","Sábado"); $mesesN=array(1=>"Enero","Febrero","Marzo","Abril" ,"Mayo","Junio","Julio","Agosto","Septiembre","Oct ubre","Noviembre","Diciembre");
return $diassemanaN[$diasemana].", $dia de ". $mesesN[$mes] ." de $ano";
}

?>


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ORBITEL S.A. // Telecomunicaciones // Resultado</title>
<style type="text/css">
<!--
.Estilo4 {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 12px;

}

BODY {
SCROLLBAR-FACE-COLOR: #CCCCCC; SCROLLBAR-HIGHLIGHT-COLOR: #D6D3CE;
SCROLLBAR-SHADOW-COLOR: #006699; SCROLLBAR-3DLIGHT-COLOR: #003366;
SCROLLBAR-ARROW-COLOR:#6699CC; SCROLLBAR-TRACK-COLOR:#D8D8D8 ;
SCROLLBAR-DARKSHADOW-COLOR: #003366
}
a:link {
color: #000000;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: underline;
color: #006699;
}
a:active {
text-decoration: none;
color: #000000;
}
.Estilo16 {font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 11px; font-weight: bold; color: #FFFFFF; }
.Estilo17 {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 14px;
color: #FFFFFF;
font-weight: bold;
}
.Estilo19 {
font-size: 12px;
color: #EEEEEE;
}
.Estilo20 {
color: #003366;
font-weight: bold;
font-size: 14px;
}
.Estilo21 {color: #000000}

-->
</style>
</head>

...
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:00.