Hago un llamado a su logica de programacion
Veran trato de imprimir unos checkbox dependiendo de una tabla donde el usuario tiene dos camque que son como una categoria y una subcategoria con este codigo PHP
Código PHP:
while ($this->registrosTipo = mysql_fetch_array ($this->ejecutar1)) // creo un while para que muestre los registros mientras alla resultados en el array
{
echo "<h3>".$this->registrosTipo['tp_nombre']."</h3>";
$this->consultaSubTipo = "SELECT * FROM tbl_tipo_sub_perfil WHERE tp_codigo=".$this->registrosTipo['tp_codigo']." ORDER BY tp_codigo;"; // hago otra consulta para que me muestre los subtipos
$this->ejecutar2 = mysql_query ($this->consultaSubTipo, $this->conexion);
while ($this->registrosSubTipo = mysql_fetch_array ($this->ejecutar2))
{
$this->consultaTipoPerfil = "SELECT pu_tp_codigo, pu_tsp_codigo FROM tbl_perfil_usuario WHERE id_acceso =".$this->id;
$this->ejecutarID = mysql_query ($this->consultaTipoPerfil, $this->conexion);
while ($this->registrosPerfil = mysql_fetch_array($this->ejecutarID))
{
if (($this->registrosTipo['tp_codigo'] == $this->registrosPerfil['pu_tp_codigo']) && ($this->registrosSubTipo['tsp_codigo'] == $this->registrosPerfil['pu_tsp_codigo']))
{
$estado = "checked='checked'";
}
else
{
echo "me fui por aca";
$estado = "checked=''";
}
echo "<input name='check[]' id='".$this->registrosSubTipo['tsp_nombre']."' type='checkbox' value='".$this->registrosSubTipo['tp_codigo']."-".$this->registrosSubTipo['tsp_codigo']."' ".$estado." />";
echo "<label class='choice' for='".$this->registrosSubTipo['tsp_nombre']."'>".$this->registrosSubTipo['tsp_nombre']."</label>";
break;
}
}
}
Bueno el me imprime los checkbox pero me los pone todos en checked y necesito que solo me aparencan en checked los campos que concuerden con los dos campos del la tabla del perfil del usuario
Muchas gracias por la ayuda.
Juan Esteban
me diste la idea y ya lo organice. Estoy eternamente agradecido con tu ayuda.

