i want to make toefl test. i make table score_structure in database. that is contain 4 columns (email, right, false, score). so, if a user has done on previous test and will perform a test , then the user data will be updated according to the user’s email pitch .
I have tried but failed, the data will not update. please help me
this is structure.php
<?php
$email = $_SESSION['email'];
$cek=mysql_num_rows(mysql_query("SELECT email FROM score_structure WHERE email='$email'"));
if($cek > 0 ){
$simpan = "UPDATE score_structure SET right='$right', false='$false', score='$score' WHERE email='$email'";
if(mysql_query($simpan)){
header("location:test_listening.php");
}else {
echo mysql_error();
}
else{
$simpan = "INSERT INTO score_structure VALUES ('$email', '$right', '$false', '$score')";
if(mysql_query($simpan)){
header("location:test_listening.php");
}else {
echo mysql_error();
}
}
?>