The statement you've written is only correct if you also want the associated 'name' field to be NULL.
If you actually want both fields to be populated you should do:
INSERT INTO opt (name, confirmed) VALUES (?, ?)
and then use the mysqli
or PDO
family of functions to bind the ?
parameters to the user-supplied values. This is necessary to protected your database against SQL injection attacks.
I would also consider adding another couple of fields:
- A unique
id
field (MySQL's auto_increment
is good for this) so that you can delete and/or modify specific records
- A
timestamp
field so that you've got a record (pun not intended) of when this data was added