0
I’ve been through my code and I can’t find the reason he’s adding two records to the database.
Function:
public static function create($table, array $params) {
$key = array_keys($params);
$value = array_values($params);
$key = "`" . implode("`, `", $key) . "`";
$value = "'" . implode("', '", $value) . "'";
$sql = "INSERT INTO `" . self::$_prefix . "{$table}` ({$key}) VALUES ({$value})";
$pdo = self::get()->query($sql);
$pdo->execute();
}
Function call:
Connect::create('users', array(
'name' => 'Guilherme',
'lastname' => 'Alsdfafdves',
'email' => '[email protected]',
'username' => 'caraiosssss',
'password' => '123456',
));
The
execute()
I don’t know if it works, thequery()
already does the Insert– rray
opa solved :)
– Guilherme SpinXO
Great! Create an answer with the details of how you solved it :)
– rray