すくすくゴートうちゃんのサーヴァ(黒歴史)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

43 lines
713 B

  1. <?php
  2. class
  3. Chat
  4. {
  5. private $db;
  6. private $id;
  7. var $user_id;
  8. var $pass;
  9. function
  10. __construct ()
  11. {
  12. $config = include ('./config.php');
  13. $db_host = $config['host'];
  14. $db_port = $config['port'];
  15. $db_user = $config['user'];
  16. $db_pass = $config['pass'];
  17. $this -> db = new mysqli ($db_host, $db_user, $db_pass, 'goatoh_training',
  18. $db_port);
  19. }
  20. function
  21. insert ():
  22. void
  23. {
  24. $sql = "
  25. INSERT INTO
  26. chats (
  27. user_id,
  28. text)
  29. VALUES
  30. (
  31. {$this -> user_id},
  32. '{$this -> text}')";
  33. $this -> db -> query ($sql) or die ("db_insert error $sql");
  34. }
  35. }