Ver Mensaje Individual
  #18 (permalink)  
Antiguo 21/07/2013, 14:43
PSPforever
 
Fecha de Ingreso: marzo-2008
Mensajes: 186
Antigüedad: 16 años, 1 mes
Puntos: 3
Respuesta: Novato con POO: me salta error al hacer consultas

Nuevamente gracias. He probado lo ultimo que decís, con estas líneas:

Código PHP:
Ver original
  1. $qry = " SELECT id_pagina,titulo,orden FROM ". $this -> queryTable();
  2.             echo $qry;
  3.             $consulta = $db -> prepare($qry);
  4.             //var_dump($consulta);

En pantalla imprime la consulta con el error:

SELECT id_pagina,titulo,orden FROM Error: 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

Y activando el var dump aparece más detalle:

Código PHP:
Ver original
  1. SELECT id_pagina,titulo,orden FROM
  2. object(PDOStatement)#4 (1) { ["queryString"]=> string(36) " SELECT id_pagina,titulo,orden FROM " }
  3. Error: 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

Intuyo que $this->queryTable() no muestra valor.