Skip to content

Instantly share code, notes, and snippets.

View nayanchy's full-sized avatar

nayanchy

View GitHub Profile
@nayanchy
nayanchy / PDO INSERT INTO DATABASE
Created July 11, 2019 07:20
Simple form to insert into Database using PDO
<?php
if(isset($_POST['submit'])){
try{
$DB = new PDO('mysql:host=localhost; dbname=databasename;', 'user', 'pass');
$DB->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}catch(PDOException $error){
echo 'Database connection error';
}