i am new in php. I want to create a online toefl test. Now I want to calculate the final score of the user. I want to take the data from the two tables of the database, that is score_structure table and score_listening table.
I would like to take the score from the score_structure table and score_listening table and then count them. but when i run it, score from table score_Sturcute and table score_listening did not get in. please help mee
this is my code:
<? php
$email = $_SESSION['email'];
$final="SELECT score_listening.score_list,score_structure.score_struct FROM score_listening, score_structure WHERE score_listening.email = score_structure.email
AND score_listening.email = $email";
$ex=mysql_query($final);
$data=mysql_fetch_array($ex);
$ScoreListening=$data['score_list'];
$ScoreStructure=$data['score_struct'];
$SkorAkhir = (($ScoreListening+ $ScoreStructure+ $score)/3) * 10;
$simpan = "INSERT INTO score_reading VALUES ('$email', '$score')";
$NA = "INSERT INTO final_score VALUES ('$email', '$ScoreListening', '$ScoreStructure', '$score', '$FinalScore')";
if(mysql_query($simpan) && mysql_query($NA)){
header("location:index.php");
}else {
echo mysql_error();
}
}
?>