本文介紹了(致命錯誤:在非對象上調用成員函數 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())的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!