I'm having trouble getting this to work w/out getting "Call to undefined method PDO::execute() in C:\xampp\htdocs\bookmarks\index.php on line 5"
<?php
function addBookmark($url, $conn){
$conn->prepare('INSERT INTO entries (url) VALUES (:url)');
$conn->execute(array(':url' => $url));
}
try {
$conn = new PDO('mysql:dbname=bookmarks;host=localhost', 'username', 'password');
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
if(isset($_POST['bookmark'])) {
addBookmark($_POST['bookmark'], $conn);
}
$results = $conn->query('select * from bookmarks.entries');
} catch (exception $e) {
die($e->getMessage());
}
?>
I just started fooling around with PDO today so I don't have the best grasp on the concept. Any help would be greatly appreciated.