Php mysql_close():提供的参数不是有效的mysql链接

Php mysql_close():提供的参数不是有效的mysql链接,php,mysql,Php,Mysql,我刚刚主持了我的自我培训网站,现在我收到了这个警告。我知道我一定没有打开警告通知,所以现在它出现了。如何修复它。 您可以在此处查看警告消息 这是我的php代码 <html> <?php require("db_connect.php"); ?> <head> <title>Instant Blog</title> <link href='images/home.ico' rel='icon' type='imag

我刚刚主持了我的自我培训网站,现在我收到了这个警告。我知道我一定没有打开警告通知,所以现在它出现了。如何修复它。
您可以在此处查看警告消息

这是我的php代码

<html>
<?php
require("db_connect.php");

    ?>
<head>
    <title>Instant Blog</title>
<link href='images/home.ico' rel='icon' type='image/vnd.microsoft.icon'/>
    <link rel="stylesheet" href="style.css">
</head>
<body>
<div class="postsContainer">
    <?php while($row = mysql_fetch_array($result))
              {
              echo "<p class=\"postedText\">" . $row['post'] . "</p>";
              }
$something = mysql_close($db_conn); //Warning points here.
?>
</div>
    <form action="index.php" method="post">
        <div class="container">
            <textarea rows="10" name = "blogText" cols="150" class="blogBox"></textarea>
            <input type="image" src="images/button.png" name="btnPost" value="Post" class="postButton" style="" padding-top: 2px;/>
        </div>
    </form>
</body>

即时博客

PHP.net:mysql关闭 通常不需要使用mysql_close(),因为非持久打开的链接会在脚本执行结束时自动关闭

您不必使用,但这应该是
$db\u conn=mysql\u connect('example.com:3307','mysql\u user','mysql\u password')

$db_conn = mysql_connect('localhost', 'mysql_user', 'mysql_password');

mysql_close($db_conn);

您没有从
db\u connect.php
关闭
$db\u conn
如果有人遗漏了原始帖子中的评论,问题是变量
$db\u conn
是错误的。

var\u dump($db\u conn)
查看它是什么。如果连接真的被称为$db\u conn,请检查db\u connect.php。另外,为什么要将其定义为变量?只需调用mysql\u close($db\u conn)。我还建议您阅读文档。@Griffin是的,问题是变量名。你是发布“Whaaaaaaaaaaaaaatt”的人吗?@Prometheus87不,我没有发布“Whaaaaaaaaaaaaaatt”。很高兴我能帮忙。@Prometheus87我发布了“Whaaaaaaaaaaaaaaaatt”。