/ Published in: PHP
This is the first version of my PHP DB connection class using ODBC
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php class DB_CONNECTION { private $server; private $user; private $pass; private $db; private $constring; protected $resultSet; private $conn; public $rowCount; function __construct($connectNow = true) { $this->server = 'myserver'; $this->db = 'db_name'; $this->user = 'db_user'; $this->pass = 'db_pass'; $this->constring = "DRIVER={SQL Native Client};SERVER=$this->server;DATABASE=$this->db"; if($connectNow) { $this->connect(); } } public function connect() { } public function disconnect() { } public function executeQuery($sqlString, $sqlParams = null, $errMsg = 'Unkwon Error') { if($this->resultSet) { } if($sqlParams==null) { } else { } } public function fetchArrayList() { { } $this->fetchRowCount($rows); return $rows; } public function fetchArrayListEx() { $i = 0 ; $j = 0; { { } $tmpResult[$i] = $ar; $i++; } //sets row count property $this->fetchRowCount($tmpResult); return $tmpResult; } private function fetchRowCount($arrCount ) { { } } public function printOut($obj) { echo "<pre>"; echo "</pre>"; } } ?>