The code is already working, but I couldn't fully understand how the place-holders is calling the value of an associative array. I already read the documentation but without success to understand it.
$app['dtb'] -> insert('users', [
'name' => $_POST['name']
'age' => $_POST['age], ]);`
My insert method:
$sql = sprintf(
'insert into %s (%s) values (%s)',
$table,
implode(', ' , array_keys($parameters)),
':' . implode(', :' , array_keys($parameters))
);
So this would result on something like this:
insert into users (name) values (:name)
If i'm not using any bind_param
how it identify that :name
is the value of the key name
?