Skip to content
This repository was archived by the owner on Mar 28, 2019. It is now read-only.

Commit b44c9e0

Browse files
unknownunknown
authored andcommitted
Performance Enhance in eval.php
1 parent 9a6d786 commit b44c9e0

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

eval.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@
3131
$query = "INSERT INTO `solve` ( `problem_id` , `username`, `soln`, `filename`, `lang`) VALUES ('".$_POST['id']."', '".$_SESSION['username']."', '".$soln."', '".$filename."', '".$lang."')";
3232
else {
3333
// update database if it is a re-submission
34-
$tmp = "SELECT attempts FROM solve WHERE (problem_id='".$_POST['id']."' AND username='".$_SESSION['username']."')";
35-
$result = mysql_query($tmp);
36-
$fields = mysql_fetch_array($result);
37-
$query = "UPDATE solve SET lang='".$lang."', attempts='".($fields['attempts']+1)."', soln='".$soln."', filename='".$filename."' WHERE (username='".$_SESSION['username']."' AND problem_id='".$_POST['id']."')";
34+
$query = "UPDATE solve SET lang='".$lang."', attempts=attempts+1, soln='".$soln."', filename='".$filename."' WHERE (username='".$_SESSION['username']."' AND problem_id='".$_POST['id']."')";
3835
}
3936
mysql_query($query);
4037
// connect to the java compiler server to compile the file and fetch the results

0 commit comments

Comments
 (0)