mysql - How to automatic update data in database in PHP -


i want make toefl test. make table score_structure in database containing 4 columns (email, right, false, score). if user has done on previous test , perform test again, user data updated according user's email pitch.

i have tried failed, data not update. please me.

this structure.php

<?php $email = $_session['email']; $cek   = mysql_num_rows(mysql_query("select email score_structure email='$email'"));  if($cek > 0 ) {    $simpan = "update score_structure set right='$right', false='$false', score='$score' email='$email'";    if(mysql_query($simpan)) {      header("location:test_listening.php");    } else {      echo mysql_error();    } else {      $simpan = "insert score_structure values ('$email', '$right', '$false', '$score')";      if(mysql_query($simpan)) {        header("location:test_listening.php");      } else {        echo mysql_error();      }    }   ?> 

update update query & let know feedback:

$simpan = "update score_structure set `right`='$right', `false`='$false', `score`='$score' email='$email'"; 

also mysql_() depreciated use mysqli_()


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo