note 127619 added to function.mysql-connect
| From: | philipp at ikv dot de | Date: | Tue, 13 Sep 2022 11:37:38 +0000 |
| Subject: | note 127619 added to function.mysql-connect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-219563@lists.php.net to get a copy of this message | ||
Connect Class, couldn't find one online
<?php
class Database
{
private static $conn = null;
public function __construct()
{
exit('Init function is not allowed');
}
public static function connect()
{
if (self::$conn == null) {
self::$conn = new mysqli("localhost", "root", "",
"article_db");
}
return self::$conn;
}
public static function disconnect()
{
self::$conn = null;
}
}
?>
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.173 (proxied: 178.191.114.136)
----
Manual Page -- https://php.net/manual/en/function.mysql-connect.php
Edit -- https://main.php.net/note/edit/127619
Del: integrated -- https://main.php.net/note/delete/127619/integrated
Del: useless -- https://main.php.net/note/delete/127619/useless
Del: bad code -- https://main.php.net/note/delete/127619/bad+code
Del: spam -- https://main.php.net/note/delete/127619/spam
Del: non-english -- https://main.php.net/note/delete/127619/non-english
Del: in docs -- https://main.php.net/note/delete/127619/in+docs
Del: other reasons-- https://main.php.net/note/delete/127619
Reject -- https://main.php.net/note/reject/127619
Search -- https://main.php.net/manage/user-notes.php