(Fatal error: Call to a member function bind_param() on a non-object)((致命错误:在非对象上调用成员函数 bind_param()))
本文介绍了(致命错误:在非对象上调用成员函数 bind_param())的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到此文本的错误:(对不起,我的英语不好,我来自德国!)
I get an error with this text:(sorry for my bad english I am from germany!)
错误:致命错误:在第 44 行的/users/ftf/www/ccache.php 中的非对象上调用成员函数 bind_param()
来自 ccache.php 的部分代码
A part of the Code from ccache.php
// Neues Datenbank-Objekt erzeugen
$db = @new mysqli( 'localhost', 'ftf', '***', 'ftf' );
// Pruefen ob die Datenbankverbindung hergestellt werden konnte
if (mysqli_connect_errno() == 0)
{
$sql = "INSERT INTO cache
('name', 'user', 'veroefentlichung', 'beschreibung', 'FTFcode', 'STFcode', 'TTFcode', 'type', 'lat', 'lon', 'address', 'link')
VALUES ('?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?')";
$eintrag = $db->stmt_init();
$eintrag = $db->prepare( $sql );
$eintrag->bind_param($titel, $user, $datum, $desc, $FTF, $STF, $TTF, $type, $Lat, $Lon, $shortdesc, $genlink); // line 44
$eintrag->execute();
// Pruefen ob der Eintrag efolgreich war
if ($eintrag->affected_rows == 1)
{
echo 'Der neue Eintrage wurde hinzugefügt.';
}
else
{
echo 'Der Eintrag konnte nicht hinzugefügt werden.';
}
}
推荐答案
$eintrag->bind_param($titel, $user, $datum, $desc, $FTF, $STF, $TTF, $type, $Lat, $Lon, $shortdesc, $genlink); // line 44
你需要这样定义参数的类型:
You need to the define the type of parameters as this:
$eintrag->bind_param("ssssssiiss", $titel, $user, $datum, $desc, $FTF, $STF, $TTF, $type, $Lat, $Lon, $shortdesc, $genlink); // line 44
s - 字符串我 - 整数还要检查文档:http://php.net/manual/en/mysqli-stmt.bind-param.php
s - string i - int Also check documentation: http://php.net/manual/en/mysqli-stmt.bind-param.php
这篇关于(致命错误:在非对象上调用成员函数 bind_param())的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
沃梦达教程
本文标题为:(致命错误:在非对象上调用成员函数 bind_param())


基础教程推荐
猜你喜欢
- 在多维数组中查找最大值 2021-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01