Ver Mensaje Individual
  #3 (permalink)  
Antiguo 15/05/2013, 09:53
mandygr87
 
Fecha de Ingreso: abril-2013
Mensajes: 82
Antigüedad: 11 años
Puntos: 0
Respuesta: join en consulta

Gracias por responder tan rápido. He probado así y me aparece el siguiente error.

Message: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

Si lo hago de esta manera sí me funciona.

Código PHP:
Ver original
  1. $db = Zend_Db_Table::getDefaultAdapter();
  2.         $select = new Zend_Db_Select($db);
  3.         $select->from('usuario')
  4.              ->joinInner('cliente', 'cliente.dni=usuario.dni')
  5.              ->where('usuario.dni LIKE ?', $dni)
  6.              ->where('nombre LIKE ?', $nombre)
  7.              ->where('apellidos LIKE ?', $apellidos);
  8.         return $db->fetchAll($select);

¿Me podrias explicar qué es lo que hace getDefaultAdapter? Gracias.