在我的本地/开发环境中,MySQLi查询执行正常.但是,当我在我的Web主机环境中上传它时,我收到此错误:
致命错误:在...中的非对象上调用成员函数bind_param()
这是代码:
global $mysqli;
$stmt = $mysqli->prepare("SELECT id, description FROM tbl_page_answer_category WHERE cur_own_id = ?");
$stmt->bind_param('i', $cur_id);
$stmt->execute();
$stmt->bind_result($uid, $desc);
Run Code Online (Sandbox Code Playgroud)
为了检查我的查询,我试图通过控制面板phpMyAdmin执行查询,结果是OK.
我正在尝试在内容表中插入值.如果我在VALUES中没有PHP变量,它可以正常工作.当我将变量$type放在VALUES中时,这不起作用.我究竟做错了什么?
$type = 'testing';
mysql_query("INSERT INTO contents (type, reporter, description)
VALUES($type, 'john', 'whatever')");
Run Code Online (Sandbox Code Playgroud)