I am trying to insert data into table from a form submission. I've already insured that there is connection with the database. I would like to know if I am doing this properly. Here is my code.
//INSERT INTO TABLE
$name = trim($_POST['name']);
$bio = trim($_POST['bio']);
$email = trim($_POST['email']);
if(isset($name, $bio, $email)) {
if($db->query("
INSERT INTO users(name, bio,email, created,updated)
VALUES ('{$name}', '{$bio}','{$email}', NOW())")) {
echo 'number of rows effected by the INSERT:', $db->affected_rows;
}
}
Please keep in mind, I am just new PHP, thanks for your help.