問題描述
這就是我必須將發(fā)送器信息構(gòu)建到 php 文件以在登錄頁面時(shí)發(fā)送到登錄頁面的方式
this is how I have to build the transmitters infomation on to a php file to send to login page when it is
<form action="http://,,,.dk/activate_updater.php" method="post" name="formular" onsubmit="return validerform ()">
<table border="0">
<tr>
<td id="tb-w_a"><p>Kategori</p></td>
<td>:</td>
<td>
<select name="kategori">
<?php
$query = "SELECT id_katogori, navn FROM kategori";
$result = $mysqli->query($query);
while(list($id_katogori, $navn) = $result->fetch_row())
{
echo "<option value="$id_katogori">$navn</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td id="tb-w_a"><p>Djnavn</p></td>
<td>:</td>
<td><input type="text" name="djnavn"></td>
</tr>
<tr>
<td id="tb-w_a"><p>Facebook</p></td>
<td>:</td>
<td><input type="text" name="facebook"></td>
</tr>
<tr>
<td id="tb-w_a"><p>Pris</p></td>
<td>:</td>
<td><input type="text" name="pris"></td>
</tr>
<tr>
<td id="tb-w_a"><p>Booking Email</p></td>
<td>:</td>
<td><input type="email" name="booking"></td>
</tr>
<tr>
<td id="tb-w_a"><p>Mobil</p></td>
<td>:</td>
<td><input type="text" name="mobil"></td>
</tr>
<tr>
<td id="tb-w_a"><p>Upload Profil</p></td>
<td>:</td>
<td><input type="file" name="profilbillede" /></td>
</tr>
</table>
<textarea name="profiltekst" style="width:500px; height:170px;"></textarea><br />
<input type="submit" value="Godkend brugere" name="godkendt-brugere">
</form>
所以新的頁面文件是這樣的,頁面上有錯(cuò)誤..
so the new page file is like this where there are errors on the page ..
<?php
if($stmt = $mysqli->prepare('UPDATE `brugere` SET `rank`=2, `katogori`=?, `djnavn`=?, `profilbillede`=?, `profiltekst`=?, `facebook`=?, `pris`=?, `booking`=?, `mobil`=? WHERE `code`=?'))
{
$stmt->bind_param('iiiiiiiis', $katogori, $djnavn, $profilbillede, $profiltekst, $facebook, $pris, $booking, $mobil, $g_code);
//fra input ting ting..
$katogori = $_POST["kategori"];
$djnavn = $_POST["djnavn"];
$profilbillede = $_POST["profilbillede"];
$profiltekst = $_POST["profiltekst"];
$facebook = $_POST["facebook"];
$pris = $_POST["pris"];
$booking = $_POST["booking"];
$mobil = $_POST["mobil"];
$g_code = $_GET["code"];
$stmt->execute();
$stmt->close();
header('http://....dk/ (...));
}
else
{
echo 'Der opstod en fejl i erkl?|ringen: ' . $mysqli->error;
}
?>
但是當(dāng)它出現(xiàn)在文件/頁面上時(shí)會(huì)這樣說......
but when it comes onto the file / page says it like this ...
致命錯(cuò)誤:在第 2 行的/home/jesperbo/public_html/....dk/activate_updater.php 中的非對(duì)象上調(diào)用成員函數(shù) prepare()
就是這樣寫的
if($stmt = $mysqli->prepare('UPDATE `brugere` SET `rank`=2, `katogori`=?, `djnavn`=?, `profilbillede`=?, `profiltekst`=?, `facebook`=?, `pris`=?, `booking`=?, `mobil`=? WHERE `code`=?'))
我不是最能看到錯(cuò)誤的人,但如果你看到我不必要的錯(cuò)誤,因?yàn)樗粫?huì)出現(xiàn)在數(shù)據(jù)庫中,那就太好了
希望你能幫我解決這個(gè)問題!
推薦答案
發(fā)生這種情況是因?yàn)?$mysqli
不是您認(rèn)為的對(duì)象.'沒有正確實(shí)例化 MySQLi
類,或者它沒有建立連接.執(zhí)行 var_dump($mysqli)
以獲取有關(guān)問題的更多信息.
This is happening because $mysqli
isn't the object you think it is. Either you didn't instantiate the MySQLi
class properly, or it didn't make a connection. Do a var_dump($mysqli)
to get more info as to what's going wrong.
這篇關(guān)于致命錯(cuò)誤:在非對(duì)象上調(diào)用成員函數(shù) prepare()的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!