Code: Alles auswählen
<?PHP
class db
{
var $connection;
// get mysql connect
function sql_connect($server, $user, $password, $database)
{
$this->connection = mysql_connect($server, $user, $password);
$this->connection = mysql_select_db($database);
if (!$this->connection)
{
die(mysql_error());
}
else
{
return $this->connection;
}
}
// close connect
function sql_close()
{
$this->connection = mysql_close($this->connection);
if (!$this->connection)
{
die(mysql_error());
}
else
{
return $this->connection;
}
}
}
$db = new db;
$db->sql_connect("localhost","root","","guestbook");
$db->sql_close();
?>
Worauf muss ich denn achten?Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in C:\Programme\xampp\htdocs\GreatBook\sql_class.php on line 26