PDO
| From: | Silvio Siefke | Date: | Mon, 22 Oct 2012 21:27:19 +0000 |
| Subject: | PDO | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-319562@lists.php.net to get a copy of this message | ||
Hello,
i have built php 5.4.7 on Ubuntu with the configure Arguments like on my
Gentoo System. But on Gentoo run the website without Problems, under Ubuntu
want not work. I become in error.log:
[22-Oct-2012 21:15:00 UTC] PHP Fatal error: Call to a member function
prepare() on a non-object in html/index.html on line 23
U use PHP FPM with Nginx.
The configure Arguments:
http://pastebin.geany.org/qz8TP/
The Script which work:
<?php
require_once ("db.php");
$query = $db->prepare("SELECT id, title, date FROM bloggen ORDER BY date DESC LIMIT
0,5");
if (!$query) {die("Execute query error, because: " . $db->errorInfo());}
$query->execute();
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
echo "<p><a href=\"/blog/post.html?id=".$row['id']."\"
title=\"".(htmlentities($row['title'], ENT_QUOTES,
"UTF-8"))."\">".(htmlentities($row['title'], ENT_QUOTES,
"UTF-8"))."</a></p>\n";
}
$row = null;
$query = null;
$db = null;
?>
Has someone a idea what is there wrong?
Thanks for help and nice Day.
Silvio