PHP中UPDATE准备语句的问题

Cod*_*oso 5 php mysql prepared-statement

我有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();
Run Code Online (Sandbox Code Playgroud)

这引起了我的兴趣

致命错误:在非对象上调用成员函数bind_param()

参考第4行(最后一行之上).

@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);
Run Code Online (Sandbox Code Playgroud)