Data does not send to the database [closed]

2

So, I created a CRUD class, the code is not returning any errors, but it is not being inserted into the database. I've tried to clean it in many ways, but I can not find a way.

CRUD.class.php

class CRUD extends Connection 
    {
        private $query, $run;
        public function __construct()
        {
            parent::__construct('mysql:dbname=vamo; host=localhost','Admin','admin');
        }

        private function set_statement($s)
        {
            if (is_object(parent::con())):

                $this->query = parent::con()->prepare($s);

            else :

                die(parent::kill_with_style($s));

            endif;
        }

        private function do_run()
        {
            $this->query->execute($this->run);
        }

        public function run($r = [])
        {
            $this->run = $r;

            $this->do_run();

            return $this->query;
        }   

        public final function insert($table, $values)
        {

            $this->set_statement("INSERT INTO ".$table." SET ".$values.""); 
            return $this;
        }
    }

connection.class.php

class Connection extends CreateArchive
    {
        private $dsn, $user, $pass,
                $con, $error_con;
        public function __construct($dsn,$user,$pass)
        {
            $this->dsn = $dsn;
            $this->user = $user;
            $this->pass = $pass;

            $this->set_con();
        }
        private function set_con()
        {
            try
            {

                $this->con = new PDO($this->dsn, $this->user,$this->pass);
                print "Conectado";

            } catch(PDOException $e) 
            {
                $this->error_con = 'Falha na conexão';

                parent::c_archive('log/', 0700,'log_con.txt','a',$e->getMessage().PHP_EOL.'{ocorreu na linha: }'.$e->getLine());
            }
        }
        public function con()
        {

            return $this->con;
        }

        public function kill_with_style()
        {
            return '<pre class=error-die>'.$this->error_con.'</pre>';
        }
    }

head.php

   $crud->insert('tbl_user','user = ?, mail = ?, pass = ?')
     ->run(['teste', '[email protected]', 12345678]);

index.php

    require_once 'config/config.php';
    require_once 'header.php';

config.php

  error_reporting(E_ALL);

date_default_timezone_set('America/Sao_Paulo');

require_once 'class/AutoLoad.class.php';

$crud = new CRUD;
    
asked by anonymous 25.01.2018 / 14:51

0 answers