-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewsletter_email.php
31 lines (25 loc) · 996 Bytes
/
newsletter_email.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
$servername = "localhost";
$username = "newsletter01";
$password = "5ca~#D8*6%r}";
$dbname = "newsletter-signups";
$email= $_POST["newsletter"];
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
//$sql = "INSERT INTO `newsletter-email` (`email`, `domain`, `date`)
//VALUES ('.$email.', 'microtechna.com', '2017-06-06')";
$sql = "INSERT INTO `newsletter-email` (`email`, `domain`)
VALUES ('$email', 'microtechna.com')";
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
// Reference SQL Query
//CREATE TABLE `test`.`newsletter-email` ( `email` VARCHAR(50) NOT NULL , `domain` VARCHAR(50) NOT NULL , `record-date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`email`,`domain`)) COLLATE='latin1_swedish_ci' ENGINE=MyISAM;
?>