チャット

This commit is contained in:
2023-07-02 14:58:25 +09:00
parent 69194b550a
commit 8f615db95a
4 changed files with 41 additions and 45 deletions
+6 -21
View File
@@ -3,29 +3,13 @@
class
Chat
{
private $db;
private $id;
var $user_id;
var $pass;
function
__construct ()
{
$config = include ('./config.php');
$db_host = $config['host'];
$db_port = $config['port'];
$db_user = $config['user'];
$db_pass = $config['pass'];
$this -> db = new mysqli ($db_host, $db_user, $db_pass, 'goatoh_training',
$db_port);
}
var $id;
var $user_id;
var $pass;
function
insert ():
void
int
{
$sql = "
INSERT INTO
@@ -36,7 +20,8 @@ Chat
(
{$this -> user_id},
'{$this -> text}')";
$this -> db -> query ($sql) or die ("db_insert error $sql");
$GLOBALS['__db_connection'] -> query ($sql)
or die ("db_insert error $sql");
}
}