I have a script which takes data, and write in MySQL:
ID Time Data
1 10:20 Orange
2 10:21 Apple
3 10:22 Strawberry
4 10:23 Strawberry
5 10:24 Peach
How can I not enroll the code if the previous data the same, like this:
ID Time Data
1 10:20 Orange
2 10:21 Apple
3 10:22 Strawberry
4 10:24 Peach
This is my code to insert into th MYSQL database
$sql = "INSERT INTO MyTable (Time, Data)
VALUES ('$time', '$data');";
if ($conn->mysql_query($sql) === TRUE) {
echo "New records created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
But this script does not have this exception :/
How I can make this?