Reputation: 3815
I just hosted my self-training site and now i am getting this warning. I know that I must not have had warning notifications turned on so now this is showing up. How can fix it.
You can have a look at the warning message over at this site
here is my php code
<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>
Upvotes: 0
Views: 971
Reputation: 644
If anyone misses out on the comments in the original post, the problem was that the variable $db_conn
was wrong.
Upvotes: 1
Reputation: 11096
From the docs
$db_conn = mysql_connect('localhost', 'mysql_user', 'mysql_password');
mysql_close($db_conn);
You are not closing $db_conn
from the db_connect.php
.
Upvotes: 0
Reputation: 1465
PHP.net : mysql-close
Using mysql_close() isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution.
You do not have to use, but $db_conn
this should be $db_conn = mysql_connect('example.com:3307', 'mysql_user', 'mysql_password');
Upvotes: 1