<?php
header('Content-Type: text/html; charset=utf-8');
class cSQLi {
public $oci;
public $rs;
public function __construct($server, $user, $pass, $db) {
$this->oci = new mysqli($server, $user, $pass, $db);
if (mysqli_connect_errno()) {
printf("Bağlantı Hatası: %s\n", mysqli_connect_error());
exit();
}
if (!$this->oci->set_charset("utf8")) {
printf("Utf8 Karakter Seçim Hatası: %s\n", $this->oci->error);
exit();
}
}
public function affRows() {
return $this->oci->affected_rows;
}
public function closeOCI() {
$this->oci->close();
}
public function closeRS() {
$this->rs->close();
}
public function escape($string) {
return $this->oci->real_escape_string($string);
}
public function killThread($tid) {
$this->oci->kill($tid);
}
public function lastID() {
return $this->oci->insert_id;
}
public function numRows() {
return $this->rs->num_rows;
}
public function query($query) {
return $this->rs = $this->oci->query($query);
}
public function fetch($query) {
while ( $row = $query->fetch_assoc() ) {
$results[] = $row;
}
return $results;
}
}
$db = new cSQLi('localhost','root', '', 'php');
$query=$db->query('SELECT * FROM php WHERE id = 1');
print_r($db->fetch($query));
print_r($db->numRows());
print_r($db->affRows());
print_r($db->lastID());
print_r($db->escape("merhaba'lar"));
print_r($db->killThread(1));
print_r($db->closeRS());
print_r($db->oci);
print_r($db->closeOCI());