Ver Mensaje Individual
  #2 (permalink)  
Antiguo 25/10/2012, 04:51
bruno911
 
Fecha de Ingreso: mayo-2004
Mensajes: 102
Antigüedad: 20 años
Puntos: 5
Respuesta: Dudas con implementacion de una clase

Yo haría algo así como:

class Anuncio{

var $nombre = null;

public function __construct() {

}

public function get_anuncio($id_anuncio, $activado){

global $conex;

$res_anuncio=mysql_query("

SELECT a.*, p.nombre AS 'provincia'
FROM anuncio a, provincia p
WHERE a.id='$id_anuncio' AND a.activado='$activado'
LIMIT 1 ", $conex);

$fila_anuncio=mysql_fetch_array($res_anuncio);



$this->nombre = $fila_anuncio['nombre'];

}
public function get_all_anuncios(){

//haces tu consulta mysql


//hacesu nloop con los datos tipo
$i="0";
do{

$array_datos[$i] = $fila_anuncio['nombre'];

$i++;


}while($fila_anuncio=mysql_fetch_array($res_anunci o))'








return $array_datos;


}
}

saludos1
__________________
Bruno Quintana