1
我試圖使網址縮短網站。然而,當我嘗試點擊提交輸入時,我遇到了這個錯誤: 致命錯誤:調用成員函數bind_param()在布爾中的C:\ xampp \ htdocs \ index.php。 我見過其他人有這個問題,但從來沒有設法解決它。 在此先感謝!致命錯誤:在C: xampp htdocs index.php中的布爾值中調用成員函數bind_param()
<?php
$db = new mysqli("localhost","root","");
if (isset($_POST['shorten'])) {
//echo "Clicked";
$result = $db->prepare("INSERT INTO links VALUES('',?,'test')");
$result->bind_param('s', $_POST['url_to_shorten']);
$result->execute();
echo "Done.";
}
?>
<!doctype html>
<html>
<head>
<title>Orix.ml - free link shortener</title>
</head>
<body>
<center>
<h1>ORIX.ML</h1>
<h2>FREE USB SHORTENING SERVICE</h2>
<form action="/" method="POST">
<input type="text" name="url_to_shorten" value="" placeholder="PASTE YOUR LINK HERE">
<input type="submit" name="shorten" value="GO">
</form>
</center>
</body>
</html>
簡單;你沒有選擇一個數據庫。 –
如果你看到其他人有這個問題,你有沒有看到使用'echo $ db->錯誤的建議;'看到錯誤的原因? – Barmar
當我說我很笨,我很愚蠢。謝謝,@ Fred-ii-,並請將其作爲答案發布,以便我可以將其選爲最佳答案。 – DimitarTheN00b