I only want it to say “Records have been inserted” 1 time. Not 100 times.
Please help.
Here is the code
$servername = “localhost”;
$username = “root”;
$password = “”;
$dbname = “data”;
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = “INSERT INTO data (jobname,promiseddate,customer,zip,city,workdesc,phone1,email,completed)
VALUES (’$jobname’,’”.$date->format(‘Y-m-d’)."’,’$customer’,’$zip’,’$city’,’$workdesc’,’$phone’,’$email’,’’)";
if ($conn->query($sql) === TRUE) {
echo “Records have been inserted”;
} else {
echo "Error: " . $sql . “
” . $conn->error;
}
}
$conn->close();
}