<?php require_once('connection.php');
session_start();
if (isset($_POST['Submit']))
{
$answ = $_POST['answ'];
$email = $_SESSION['email'];
$insert = "INSERT INTO answerList (answ,queID,email) SELECT questionList.queID FROM questionList " ;
$result = mysqli_query($con, $insert);
if (!$result) {
echo "<script>alert('ERROR !!!!! '); location='faq.php';</script>";
}
else {
echo "<script>alert('Successful Post'); location='faq.php'; </script>";
}
}
?>
I have 3 table
table 1: users(email, password)
table 2: question(questionID, questionContent, email)
table 3: answer(answerID, answerContent, questionID, email)
how can i connect questionID into table 3?
i already do the login and add question sql . but how can i add the answer to current question with logged email?