Ver Mensaje Individual
  #10 (permalink)  
Antiguo 02/03/2007, 10:39
Avatar de el cirujano
el cirujano
 
Fecha de Ingreso: mayo-2003
Ubicación: Frente al PC
Mensajes: 609
Antigüedad: 21 años
Puntos: 3
Re: Se duplican los datos en consulta MySQL

mira consegui una forma, no serà la mas viable pero me esta funcionando, se que puede haber una mejor por ahi pero bueno necesito entregar el trabajo jeje :-p

Código PHP:
// cONVIERTO TODO LO QUE CONSIGO DEL USUARIO $ID EN UN ARRAY
        
$result mysql_query("SELECT * FROM seguridad WHERE co_usuario='$ID'");
                
                    if (
mysql_num_rows($result)>0)
                        {
$i=0;
                        while (
$row mysql_fetch_array($result))
                            {
                            
$i $i +1

                           
$gmb[] =   $row["co_opcion"];
                            }
                        }
        
$erc implode($gmb,","); 

// LUEGO CON ESTE SCRIPT HAGO QUE ME VALIDE LOS CHECKBOX

        
$result mysql_query("SELECT * FROM opciones,seguridad WHERE co_usuario='$ID' GROUP BY des_opcion");
                
                    if (
mysql_num_rows($result)>0)
                        {
$i=0;
                        while (
$row mysql_fetch_array($result))
                            {
                            
$i $i +1
                                echo 
"<input ";
                                    if (!(
strpos($erc$row["cod_opcion"]) === False))
                                    {
                                        echo 
"checked ";
                                    }    
                                echo 
"type='checkbox' name='acceso$i' value='".$row[co_opcion]."'> ".$row[des_opcion]."<br />";
                            }
                        } 
YA... ME SIENTO CANSADO CON ESTE CODIGO, ME IRE A COMER ALGO PA DESPEGAR LA MENTE JEJE SALUDOS Y SI CONSIGUEN ALGO MEJOR POR FAVOR POSTEENLO ACA...
__________________
CSS2 + AJAX + PHP + MySQL, una mezcla sin competencia!!!!!!