my code stock.com

For the NominApp Project

Snippet options

Download: Download snippet as class-employeesdata.php.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

<?php
class EmpleadosData {

	// variables
	public $idEmpleado;
	public $nombre;
	public $apelllidos;
	public $edad;
	public $direccion;
	public $ciudad;
	public $estado;
	public $pais;
	public $idPuesto;
	public $puesto;
	public $salario;
	public $status;
	public $empresa;
	public $idEmpresa;

	private $q;
	private $asociar;
	private $mainAssoc;
	private $rows;

	//main function
	function __construct($empresa){

		global $cnx;
		$this->idEmpresa = $empresa;
		$this->rows = 0;

		$this->q = $cnx->query("SELECT * FROM empleados WHERE idEmpresa = '{$this->idEmpresa}'");
		
		for($this->rows = 0; $this->rows < $this->q->fetch_array(); $this->rows++){
			$this->mainAssoc = $this->q->fetch_array();

			$this->idEmpleado[] = $this->mainAssoc['idEmpleado'];
			$this->nombre[] = $this->mainAssoc['nombre'];
			$this->apellidos[] = $this->mainAssoc['apellidos'];
			$this->edad[] = $this->mainAssoc['edad'];
			$this->direccion[] = $this->mainAssoc['direccion'];
			$this->ciudad[] = $this->mainAssoc['ciudad'];
			$this->estado[] = $this->mainAssoc['estado'];
			$this->pais[] = $this->mainAssoc['pais'];
			$this->status[] = $this->mainAssoc['status'];
			$this->alario[] = $this->mainAssoc['salario'];
			$this->idPuesto[] = $this->mainAssoc['idPuesto'];
			
			$this->qq = $cnx->query("SELECT * FROM puestos WHERE idPuesto = {$this->idPuesto[$this->rows]}");
			$this->qqassoc = $this->qq->fetch_assoc();

			$this->puesto[] = $this->qqassoc['nombre'];
		}

	}

}
?>

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.