|
|
@@ -3,25 +3,9 @@ |
|
|
|
class |
|
|
|
User |
|
|
|
{ |
|
|
|
private $db; |
|
|
|
|
|
|
|
private $id; |
|
|
|
var $name; |
|
|
|
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 $name; |
|
|
|
var $pass; |
|
|
|
|
|
|
|
public static function |
|
|
|
find ( |
|
|
@@ -35,7 +19,8 @@ User |
|
|
|
user |
|
|
|
WHERE |
|
|
|
id = $id"; |
|
|
|
$result = $this -> db -> query ($sql) or die ("db_select error $sql"); |
|
|
|
$result = $GLOBALS['__db_connection'] -> query ($sql) |
|
|
|
or die ("db_select error $sql"); |
|
|
|
|
|
|
|
$row = $this -> db -> fetch_array ($result); |
|
|
|
|
|
|
|