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