Skip to content

Instantly share code, notes, and snippets.

nayanchy

Block or report user

Report or block nayanchy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nayanchy
nayanchy / PDO INSERT INTO DATABASE
Created Jul 11, 2019
Simple form to insert into Database using PDO
View PDO INSERT INTO DATABASE
<?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';
}
You can’t perform that action at this time.