Skip to content

Instantly share code, notes, and snippets.

View achshar's full-sized avatar

Achin Sharma achshar

View GitHub Profile
### Keybase proof
I hereby claim:
* I am achshar on github.
* I am achshar (https://keybase.io/achshar) on keybase.
* I have a public key whose fingerprint is 2B00 9A1B 1867 FD69 933B A2C4 05BD 7449 87CB 8037
To claim this, I am signing this object:
<!DOCTYPE HTML>
<html>
<head>
<title>reddit: the front page of the internet</title>
<link href="reddit.css" rel="stylesheet"/>
<script src="reddit.js" type="text/javascript"></script>
</head>
<body>
<form action="comments.php" method="POST">
<label for="id">id</label>
<?php
if(!empty($_POST)) {
$dbh = new PDO('mysql:dbname=reddit;host:localhost', 'root', '', array(PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING));
$query = $db->prepare('INSERT INTO posts (title, subreddit) VALUES (?, ?)');
$query->execute(array($_POST['title'], $_POST['subreddit']));
echo $_POST['id'];
}
?>
<?php if($_POST) {
$dbh = new PDO('mysql:dbname=reddit;host:localhost', 'root', '', array(PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING));
$query = $db->prepare('INSERT INTO posts (title, subreddit) VALUES (?, ?)');
$query->execute(array($_POST['title'], $_POST['subreddit']));
} ?>