Ver Mensaje Individual
  #4 (permalink)  
Antiguo 18/12/2013, 08:21
rivara
 
Fecha de Ingreso: octubre-2013
Mensajes: 20
Antigüedad: 10 años, 6 meses
Puntos: 0
Respuesta: Querys en ZF2

Buenas ya encontre la solucion, simplemente se trata de configurar bien el adapter

<?php


namespace Application\Model\Datos;

use Zend\Db\TableGateway\TableGatewayInterface;
use Zend\Db\Adapter\Adapter;
use Zend\Db\Sql\Sql;
use Zend\Db\Sql\Select;
use Zend\Db\Sql\Where;


class Querys
{
//ATRIBUTOS PUBLICOS
private $name;
private $correo;
private $adapter = array(
'driver' => 'Mysqli',
'database' => 'academius',
'username' => 'root',
'password' => ''
);




/////////////////////////////////////////
///////////ROL///////////////////////
/////////////////////////////////////////


public function getDatosRol($data){
//RECOJO LOS DATOS DEL METODO POST
$this->mail=$data["email"];
$this->pw=$data["password"];
$pw=$this->pw;
$email=$this->mail;
$dbAdapter = new Adapter($this->adapter);
$sql = new Sql($dbAdapter);
$select = $sql->select();
$select->from('rol');
$select->where(array('mail'=>$email,'password'=>$pw));
$statement = $sql->prepareStatementForSqlObject($select);
$result = $statement->execute();

foreach ($result as $value) {
$return=$value['rol'];
}
if(empty($return)){
$return=" ";
}



return $return;
}