how to check the input between users and database whether it is duplicate?
This is the form for the user to input data to database
And This code's result will be work whether it saves same or not same records.

```
    $con = mysql_connect("localhost","root","usbw");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    mysql_select_db("booking", $con);

    $year = $_POST['year'];
    $month = $_POST['month'];
    $day = $_POST['day'];
    $time = $_POST['time'];
    $classroom = $_POST['classroom']; 
    $subject = $_POST['subject'];
    $s=implode(" ",$subject);
    $sql1 = "SELECT * FROM `test` WHERE `year` LIMIT 0, 30 ";
    $result=mysql_query("$sql1");
    $row =mysql_fetch_row($result);

        $sql = "INSERT INTO `test`(`year`, `month`, `day`, `time`, `classroom`,`subject`) VALUES  ('$year','$month','$day','$time','$classroom','$s')";

    ?>

```

I wrote a code that I think that can determine the same records
if same , user can not input.
if not same user can input.
The code represent like this :

```
if($row[1]==$year){ 
　   echo'the data was repeated';

```

can anyone help to solve my if-statement problem?

Update:

```
if($row[1]==$year){ 
　   echo'the data was repeated';} else{
    $sql = "INSERT INTO `test`(`year`, `month`, `day`, `time`, `classroom`,`subject`) VALUES  ('$year','$month','$day','$time','$classroom','$s')";}

```

I wrote this syntax error....(Parse error: syntax error, unexpected '@' in )
Should I use While-loop to rewrite?
Could you please tell me how to correct the code?