Skip to content
This repository has been archived by the owner on Jul 22, 2019. It is now read-only.

Commit

Permalink
Demo code
Browse files Browse the repository at this point in the history
  • Loading branch information
nevadascout committed Mar 11, 2017
1 parent 0323426 commit ecd7d24
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);

namespace Hvy\CraneDemo;

class ConnectionDB
{

private $dbhost = "localhost";
private $dbuser = "user";
private $dbpass = "pass";
private $dbname = "dbname";

/** @var PDO */
public $conn;

public function openDbConnection()
{
try
{
$this->dbhost;
$this->dbhost = "127.0.0.1";
$this->conn = new PDO("mysql:host=$this->dbhost;dbname=$this->dbname;", $this->dbuser, $this->dbpass, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'"));
$this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
Expand All @@ -37,4 +37,4 @@ public function closeDbConnection()
echo $e->getMessage();
}
}
}
}
6 changes: 6 additions & 0 deletions client/phpTest/demo/baseInclude.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

use Hvy\CraneDemo\ConnectionDB;

$dbh = new ConnectionDB();
$dbh->openDbConnection();

0 comments on commit ecd7d24

Please sign in to comment.