Comunidad de diseño web y desarrollo en internet online

Problema con PHP y OOP

Citar            
MensajeEscrito el 14 Oct 2007 05:37 pm
Hola por favor necesito una ayuda se trata de lo sgte.
Descripcion del problema:
Se trata de un sistema en el cual se ingresa mediante un login y password, al momento de ingresar, se crea un objeto q conecta a la bd,eso no lo puse por q funciona bien, pero el problema surge cuando llamo a una funcion de cargar_modulo, y ver modulos (Los modulos son menus), y estos se generan de acuerdo al perfil del usuario que inicio sesion, para ello yo llamo a la funcion cargar_modulo y le paso como parametro el $iduser del usuario q inicio sesion.Espero haber sido claro.
Aqui les dejo el codigo


class DB_mysql{
function cargamodulo($id_usuario){

$this->id_user=$id_usuario

$this->consulta_perfil=@mysql_query("SELECT p.id_perfil,p.nom_perfil FROM usuario_perfil up,perfil p WHERE up.id_user='$id_user' and up.id_perfil=p.id_perfil",$this->conec);
#se busca el id_perfil y el nombre de perfil del usuario actual

if (!$this->consulta_perfil) {
$this->errno = mysql_errno();
$this->error = mysql_error();
}
return $this->consulta_perfil;

$arreglo1=mysql_fetch_array($this->consulta_perfil);
$id_perfil=$arreglo1["id_perfil"];
$nom_perfil=$arreglo1["nom_perfil"]; //se obtienen los 2 datos


$this->consulta_mod=@mysql_query("SELECT p.nom_privilegio FROM privilegios p,r_priv_perfil rp WHERE rp.id_perfil='$id_perfil' and rp.id_privilegio=p.id_privilegio and p.tipo='0'",$this->conec);
#se cargan los modulos correspondientes al perfil del usuario actual


if (!$this->consulta_mod) {
$this->errno = mysql_errno();
$this->error = mysql_error();
}
return $this->consulta_mod;

}

function ver_modulos(){
echo "funcion ver_modulos"; // se muestran los modulos correspondientes al perfil de usuario actual


$html='<div id="menu">';
while($arreglo2=mysql_fetch_array($this->consulta_mod)){

$this->nombre_mod=$arreglo2["nom_privilegio"];

switch ($this->nombre_mod){

case "Módulo Escaner":
$this->pagina="mod_escaner.php";
break;

case "Módulo User":
$this->pagina="mod_user.php";
break;

case "Módulo Perfil":
$this->pagina="mod_perfil.php";
break;

case "Módulo Consulta":
$this->pagina="mod_consulta.php";
break;
}
$html.='<div class="boton"><a href="'.$this->pagina.'">'.$this->nombre_mod.'</a></div>';
}
echo $html;

}
}
?>

y la otra pagina donde creo el objeto y hago el include a la clase esta
<html>
<head><title>Prueba</title></head>
<body>
<br>
<br>
<br>
<br>
<?php
include("clase_mysql.php");
$id_user=$_SESSION['usuario_id'];
$modulos = new DB_mysql;
$modulos->cargamodulo($id_user);
$modulos->ver_modulos();
?>
</body>
</html>

El error que me da es en esta linea, algo de argumento invalido

while($arreglo2=mysql_fetch_array($this->consulta_mod)){

Espero su ayuda

Por alfaxis

9 de clabLevel



Genero:Masculino  

Santiago de Chile

msie
Citar            
MensajeEscrito el 14 Oct 2007 06:48 pm

Por alfaxis

9 de clabLevel



Genero:Masculino  

Santiago de Chile

msie

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.