<?php
try {
$hostname = "localhost";
$dbname = "mydatabase";
$username = "myusername";
$pw = "mypassword";
$db = new PDO ("mysql:host=$hostname;dbname=$dbname","$username","$pw");
} catch (PDOException $e) {
echo "Failed to get DB handle: " . $e->getMessage() . "\n";
exit;
}
echo 'Hello';
$section = 1;
$userID = 99;
$clean_html = 'test !!!!!!!!!';
$stmt = $db->prepare("INSERT INTO userContent (section, author, content) VALUES (:section, :author, :content)");
$stmt->bindValue(':section', $section, PDO::PARAM_INT);
$stmt->bindValue(':author', $userID, PDO::PARAM_INT);
$stmt->bindValue(':content', $clean_html, PDO::PARAM_STR);
if (!$stmt) {
echo "\nPDO::errorInfo():\n";
print_r($dbh->errorInfo());
}
echo 'Worked';
?>
preferences:
40.47 ms | 402 KiB | 5 Q