i have this: function insert ()
the function insert data in the table users and sent an email.
I need to terminate a previous state before create another one, correct?
so, i need to store the activation link in another table, the activationLinks table.
i can make something like this? i think the code below doesn't work.
($sql = $db -> prepare("INSERT INTO users, activationLinks (username, email, password) (link) VALUES (?, ?, ?) (?)"));
basically the question, is that i need store data in two different tables, but in the same function.
You can only INSERT in to one table at a time, so if you need to insert in to two tables you need two queries (or rather: if you need to insert in to n distinct tables you need n queries)
($sql = $db -> prepare("INSERT INTO users (username, email, password) VALUES (?, ?, ?)"));
($sql2 = $db -> prepare("INSERT INTO activationLinks (link) VALUES (?)"));
And i need two ? or it is possible join this?
$sql -> bind_param('sss', $name, $email, $hash);
$sql -> execute();
$sq -> bind_param('s', $linkHash);
$sq -> execute();
No you can't join it. You really need two