UPDATEプリペアド・ステートメントに問題があり、どこにでも見られ、ここで質問を閲覧しましたが、構文が正しいと思われます。PHPのUPDATEプリペイドド・ステートメントで問題が発生しました
$update_page = $db->stmt_init();
$update_page = $db->prepare ("
UPDATE pages
SET page_title = ?, meta_description = ?, meta_keywords = ?, $content = ?
WHERE page_uri = ?
");
$update_page->bind_param('sssss', $page_title, $meta_description, $meta_keywords, $content, $page_uri);
$update_page->execute();
これは
Fatal error: Call to a member function bind_param() on a non-object
は4行(最終行以上の1)を参照する私をスローします。
@Gaurav:ここでは完全なコードだ - 私はこのページにSELECTとUPDATE文の両方を持っている、SELECT作品:
if (!isset($page_uri))
{
$page_uri = 'home';
}
if (isset($_POST['update']))
{
$page_title = htmlspecialchars($_POST['page_title']);
$meta_description = htmlspecialchars($_POST['meta_description']);
$meta_keywords = htmlspecialchars($_POST['meta_keywords']);
$content = htmlspecialchars($_POST['content']);
$update_page = $db->stmt_init();
$update_page->prepare ("
UPDATE pages
SET page_title = ?, meta_description = ?, meta_keywords = ?, $content = ?
WHERE page_uri = ?
");
$update_page->bind_param('sssss', $page_title, $meta_description, $meta_keywords, $content, $page_uri);
$update_page->execute();
}
$select_page = $db->stmt_init();
$select_page = $db->prepare ("
SELECT page_id, page_title, meta_description, meta_keywords, content, sidebar
FROM pages
WHERE page_uri = ?
LIMIT 1
");
$select_page->bind_param('s', $page_uri);
$select_page->execute();
$select_page->bind_result($page_id, $page_title, $meta_description, $meta_keywords, $content, $sidebar);
$select_page->fetch();
$page_title = htmlspecialchars_decode($page_title, ENT_QUOTES);
$meta_description = htmlspecialchars_decode($meta_description, ENT_QUOTES);
$meta_keywords = htmlspecialchars_decode($meta_keywords, ENT_QUOTES);
$content = htmlspecialchars_decode($content, ENT_QUOTES);
mysqliの場合、あなたのphpinfo()は何を表示しますか? – egis
btw、$ dbオブジェクトを開始するコードを表示します。データベースが選択されていない可能性があります;) – egis
@egis - これはコード全体です:$ db = new mysqli(DBHOST、DBUSER、DBPASS、DATABASE); - phpinfo()について、私は何を探していますか、私はmysqliをインストールしました。実際には、それ以外のものはありますか? – CodeVirtuoso