I have a strange error in this block:
public static function saveUser($form)
{
$connexion = new PDO("mysql:host=localhost;dbname=cdiscodb", 'root', 'rthr'); // connexion à la BDD
$connexion->setAttribute (PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "INSERT INTO ope_tartine_nl(first_name,last_name,email,created_date,updated_date) VALUES (?,?,?,?,?)";
$cmd = $connexion->prepare($sql);
$result = $connexion->exec(array($form['name'], $form['lastname'], $form['email'], date("Y-m-d H:i:s"), date("Y-m-d H:i:s")));
}
the error is :
Fatal error: Function name must be a string
Thanks for your help
you have given as
$connexion->execwhereas it should be$cmd->exec(......)And Use
$cmd->executeinstead of$cmd->exec.