Skip to content

Instantly share code, notes, and snippets.

@anilshanbhag
Last active December 20, 2015 08:09
Show Gist options
  • Save anilshanbhag/6098336 to your computer and use it in GitHub Desktop.
Save anilshanbhag/6098336 to your computer and use it in GitHub Desktop.
<?php
if (isset($_POST['data_of_note']))
{
$db = new PDO('mysql:host=localhost;dbname=homepage;charset=utf8', 'xxx', 'xxx');
$content = $_POST['data_of_note'];
$stmt = $db->query("INSERT INTO ReadingList (category, content) VALUES ('research', '$content')");
echo "Successful :)";
}
else
{
$db = new PDO('mysql:host=localhost;dbname=homepage;charset=utf8', 'xxx', 'xxx');
$stmt = $db->query("SELECT * FROM ReadingList");
foreach($stmt as $row) {
echo $row['Content'] . "\n";
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment