Hi all. This is just what I’ve been looking for to help me sort out a buggy bit of php code…I’m trying to be Microsoft free and I’m getting there!
Probably doing this all wrong but here’s the code…
hawksey@ELLOTOSH:/opt/lampp/htdocs/LIKEIT$ cat insert.php
// DB Info
<? PHP
$servername="localhost";
$username="root";
$password="";
$dbname="LIKEIT";
echo "$servername, $username, $dbname";
// Tell HTML details about DB;
// $conn = new mysqli ($servername, $username, $password, $dbname);
$_POST [ "first" ];
$_POST [ "surname" ];
$_POST [ "id" ];
$_POST [ "pcode" ];
// "Create and check DB Connection";
echo "BIT OF TEXT FROM PHP SCRIPT";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die ("connection failed:" . $conn->connect_error);
else
echo "Success"
}
echo $conn;
// SQL String
$sql INSERT INTO customer_details ($first, $surname, $id, $pcode);
VALUES ('$first', '$surname', '$id', '$pcode');
// Close DB Connection
$conn->close();
?>