I'm using WAMP Server and I've a simple PHP script:
include_once ('../lib/conecData.php');
$res=mysql_connect(DB_HOST,DB_USER,DB_PASS);
mysql_select_db(DB_NAME);
$sql = "SELECT * FROM `table` ORDER BY `day` DESC";
$result = mysql_query ($sql, $res);
mysql_close($res);
if ($res) echo "Still Alive"; else echo "Closed";
result:
Still Alive
I've tried: 1./----
if($res == false){
echo "Closed";
} else {
echo "Still Alive";
}
2./----
$closed = mysql_close($res);
if ( !$closed ) echo "Still Alive"; else echo "Closed";
3./----
if ( mysql_close($res)) echo "Still Alive"; else echo "Closed";
and
mysql_close();
no luck, same result.- Why is database connected?. Do I need to change something on my server's configuration?. What's wrong with this?.