Reputation: 1800
This is a file called addtime_eu.php
that adds into a SQL table called europe
a row containing some datas.
<?php
//Check connection
if (mysqli_connect_errno())
{
echo "Connection to MySQL failed: " . mysqli_connect_error() . " Please contact an admin or refresh the page.";
}
//Create MySQL connection
$con=mysqli_connect("localhost","user","password","my_mk7vrlist");
//Store datas in the table
mysqli_query($con, "INSERT INTO `europe` (`Num`,`playername`,`Friendcode`,`Country`,`Skype`,`Twitter`,`Youtube`) VALUES ('7', '".$_POST['playername']."', '".$_POST['fcs']."', '".$_POST['regione']."', '".$_POST['skype']."', '".$_POST['twitter']."', '".$_POST['youtube']."')");
//Close connection
mysqli_close($con);
echo "<br><p align='center'>Your datas has been added!<p>";
?>
This php file is called when I click this button in a page:
<form action="addtime_eu.php" method="POST">
<p align="center"><input value="Send record" type="submit"></p>
</form>
When I click this button once, the script adds into the table a row. If I try the second time to click the button, it doesn't add anything.
What should I do? Do I have to change any SQL setting?
Upvotes: 0
Views: 41
Reputation: 3848
Maybe 'Num' is a Primary Key and the Insert is failing due to the fact that you are always trying to insert the same value.
Upvotes: 1