Last active
November 22, 2017 00:30
-
-
Save Oappot/a122ff879dd73c9ea2b5d824a047c850 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include ('Connect.php'); | |
$test = new Connect; | |
$test->createUser(); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Connect { | |
public $connection; | |
public function __construct(){ | |
$this->connect(); | |
} | |
public function connect(){ | |
$connection = new PDO('mysql:host=orfarile;dbname=orfarile', 'root', ''); | |
} | |
function selectTests(){ | |
} | |
public function createUser(){ | |
$connection->query("INSERT INTO users(user_login, user_password) VALUES ('test1', 'test1')"); | |
} | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Connect { | |
private $connection; | |
function __construct(){ | |
$this->connect(); | |
} | |
function connect(){ | |
$connection = new PDO('mysql:host=orfarile;dbname=orfarile', 'root', ''); | |
$connection->query("INSERT INTO users(user_login, user_password) VALUES ('test2', 'test2')"); | |
} | |
function selectTests(){ | |
} | |
function createUser(){ | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
fixed issue#1.
issue#2:
Fatal error: Uncaught Error: Call to a member function query() on null in ~\Connect.php:19 Stack trace: #0 ~\check.php(5): Connect->createUser() #1 {main} thrown in ~\Connect.php on line 19