There are two insert requests.
As for the second request, get the value of the id field, which is formed as a result of the first one. The field is set to AUTO_INCREMENT .
Query to the first table:
$login = ($_POST['login']); $email = (trim($_POST['email'])); $password = md5(md5(trim($_POST['password']))); $sql = "INSERT INTO users (login, paroli, email) VALUES (:login, :password, :email)"; $sqlData = $pdo->prepare($sql); $sqlData->bindParam(':login', $login, PDO::PARAM_STR); $sqlData->bindParam(':password', $password, PDO::PARAM_STR); $sqlData->bindParam(':email', $email, PDO::PARAM_STR); $sqlData->execute(); Query to the second table:
$sql = "INSERT INTO images_ava (id) VALUES (:id)"; $sqlData = $pdo->prepare($sql); $sqlData->execute();
execute()insert$lastId = $db->lastInsertId();where$dbconnect to base. And use$lastIdin another request. - UserName