$user_activation_code = md5(rand());
$user_otp = rand(100000, 999999);
$data = array(
':user_name' => $user_name,
':user_email' => $user_email,
':user_password' => $user_password,
':user_activation_code' => $user_activation_code,
':user_email_status'=> 'not verified',
':user_otp' => $user_otp
);
$query = "
INSERT INTO register_user
(user_name, user_email, user_password, user_activation_code, user_email_status, user_otp)
SELECT * FROM (SELECT :user_name, :user_email, :user_password, :user_activation_code, :user_email_status, :user_otp) AS tmp
WHERE NOT EXISTS (
SELECT user_email FROM register_user WHERE user_email = :user_email
) LIMIT 1
";
$statement = $connect->prepare($query);
$statement->execute($data);
aslında bir çok yeri gayet açık ancak sorgu kafamı karıştırıyor böyle bir yapı ile ilk defa karşılaşıyorum
şu aşşağıdaki kısımda ne yapılmak isteniyor yada daha basit bi veya anlaşılabilir yazım şekli mevcutmudur ?
$query = "
INSERT INTO register_user
(user_name, user_email, user_password, user_activation_code, user_email_status, user_otp)
SELECT * FROM (SELECT :user_name, :user_email, :user_password, :user_activation_code, :user_email_status, :user_otp) AS tmp
WHERE NOT EXISTS (
SELECT user_email FROM register_user WHERE user_email = :user_email
) LIMIT 1
";