插入数据库不起作用[重复]

This question already has an answer here:

I tried to simplify this as much as possible just to understand what's happening but it's still not working. It doesn't show any errors, but nothing gets added to database.

The bootstrap file:

class Connection {
    public static function make($config){
        return new PDO(
            $config['connection'].';dbname='.$config['name'],
            $config['username'], $config['password'], $config['options']
        );  
    }
}

class QueryBuilder {
    protected $pdo;

    public function __construct($pdo){
        $this->pdo = $pdo;
    }

    public function insert($table, $paramater, $value){     
        $statement = $this->pdo->prepare("insert into $table ($paramater) values($value)");
        $statement->execute();
    }
}

return new QueryBuilder(Connection::make($config['database']));

Other file after post request:

$query = require 'bootstrap.php';

$query->test('todos', 'description', 'lorem ipsum');

My $config array is this

return [
  'database' => [
    'name' => 'mytodo', 
    'username' => 'root', 
    'password' => '', 
    'connection' => 'mysql:host=ip', 
    'options' => [ ] 
  ]
]; 
</div>

According to the manual at http://php.net/manual/en/pdo.connections.php, your connection string is missing "mysql:".

Try:

return new PDO("mysql:".$config['connection'] etc.

Also, try putting a try-catch block around it and display the message from whatever Exception it may be throwing.