PHP - Error al insertar SQLSTATE[HY000]: General error

 
Vista:
Imágen de perfil de Lucas

Error al insertar SQLSTATE[HY000]: General error

Publicado por Lucas (7 intervenciones) el 25/08/2017 05:23:17
hola como estan,
Estoy realizando registros, se inserta los campos pero siempre me presenta el siguiente error:

SQLSTATE[HY000]: General error

Este es el codigo capa enlace:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
$objetoNegocio=new capa_negocio_servicio($_POST["txt_titulo"],$_POST["ddl_tipo"],$_POST["ddl_categoria"],$_POST["txt_descripcion"],$_POST["txt_telefono"],$_POST['txt_celular'],$_POST['txt_mail']);
$objetoNegocio->insertar();
 
public function insertar(){
        try
        {
$this->objetoDatos->conectar();
$this->objetoDatos->ejecutar("insert into publicacion(idUsuario,titulo,tipo,categoria,descripcion,telefono,celular,email) values(1,'$this->titulo','$this->tipo','$this->categoria','$this->descripcion','$this->telefono','$this->celular','$this->email')");
$this->objetoDatos->desconectar();
        }
        catch (PDOException $ex)
        {
            throw $ex;
        }

Siguiente codigo capa datos:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
public function ejecutar($strComando)
    {
        try
        {
            $ejecutar=$this->objetoConexion->prepare($strComando);
            $ejecutar->execute();
            $rows = $ejecutar->fetch();
            return $rows;
        }
        catch(PDOException $ex)
        {
            throw $ex;
        }
    }

No se si es la manera adecuado de realizar el proceso, justo en:
1
2
$rows = $ejecutar->fetch();
return $rows;

Les agradezco si me brindan sus consejos...
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder