000webhost.com
Insert
https://www.000webhost.com/forum/t/how-to-insert-data-into-mysql-database/128572/2
Belajar insert dll
https://www.bitdegree.org/learn/mysql-insert-into
konksi database
https://www.000webhost.com/forum/t/how-to-connect-to-database-using-php/42093
=========================================
Contoh Insert
<?php
$servername = "localhost";
$username = "id3865849_test";
$password = "123456";
$dbname = "id3865849_test";
$name = $_POST['name'];
$email = $_POST['email'];
$pesan = $_POST['pesan'];
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "INSERT INTO pesan1 (name, alamat, pesan)
VALUES ( '$name', '$email', '$pesan')";
// use exec() because no results are returned
$conn->exec($sql);
echo "New record created successfully//mantap";
header("location: index.php");
}
catch(PDOException $e)
{
echo $sql . "<br>" . $e->getMessage();
}
$conn = null;
?>
================================
https://www.000webhost.com/forum/t/how-to-insert-data-into-mysql-database/128572/2
Belajar insert dll
https://www.bitdegree.org/learn/mysql-insert-into
konksi database
https://www.000webhost.com/forum/t/how-to-connect-to-database-using-php/42093
=========================================
Contoh Insert
<?php
$servername = "localhost";
$username = "id3865849_test";
$password = "123456";
$dbname = "id3865849_test";
$name = $_POST['name'];
$email = $_POST['email'];
$pesan = $_POST['pesan'];
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "INSERT INTO pesan1 (name, alamat, pesan)
VALUES ( '$name', '$email', '$pesan')";
// use exec() because no results are returned
$conn->exec($sql);
echo "New record created successfully//mantap";
header("location: index.php");
}
catch(PDOException $e)
{
echo $sql . "<br>" . $e->getMessage();
}
$conn = null;
?>
================================
000webhost.com
Reviewed by Leo
on
10:09
Rating:
No comments