Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function dataBaseConnect(){
- $dbuser = 'xx';
- $dbpassword = 'xxx';
- try {
- $this->handler = new PDO('mysql:host=localhost;dbname=x', $dbuser, $dbpassword);
- $this->handler->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- } catch (PDOException $err) {
- echo $err->getMessage();
- die();
- }
- }
- function getTimeValue(){
- //$this->start= "SELECT `start_time` FROM `table_ex` WHERE id=(SELECT MAX(id) FROM `table_ex`)";
- //$this->handler->exec($this->start);
- $sql = "SELECT `start_time` FROM `table_ex` WHERE id=(SELECT MAX(id) FROM `table_ex`)";
- $this->start = $this->handler->query($sql, PDO::FETCH_COLUMN, 0);
- }
- function printVal(){
- //tak w skrócie jak chcę wykorzystać tę zmienną
- dataBaseConnect();
- getTimeValue();
- $this->messOuput = "Sth text " .$this->start;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement