Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once 'connect.class.php';
- class Get extends Connect {
- private $sql = false;
- private $baglan;
- private $hatalar = array();
- private $query;
- private $count = false;
- public $data = array();
- function __construct() {
- /*
- * Yalnızca kısaltma..
- */
- $this->baglan = parent::BaglanDB();
- }
- public function getSql($sql)
- {
- /*
- * GET SQL
- * String
- */
- if ($this->sql!==false)
- {
- unset($this->sql);
- }
- $this->sql = $sql;
- return $sql;
- }
- private function Query()
- {
- /*
- * Sorguyu çalıştırır hata varsa
- * hatayı döndürür
- */
- $this->query = mysql_query($this->sql,$this->baglan) or $error = mysql_error();
- if(!empty($error))
- {
- $this->hatalar[] = mysql_error();
- return mysql_error();
- }
- return $this->query;
- }
- public function getData()
- {
- /*
- * Veriyi çek
- */
- $this->Query();
- $query = $this->query;
- while ($row = mysql_fetch_assoc($query)) {
- $this->data[] = $row;
- $this->count = $this->count++;
- }
- return $this->data;
- }
- public function returnError()
- {
- /*
- * Hata varsa bildir
- */
- if(!empty($this->hatalar))
- {
- foreach($this->hatalar as $hatalar)
- {
- echo $hatalar . "<br/>";
- }
- }
- else
- {
- echo 'Herhangi bir hata ile karşılaşılmadı';
- }
- return true;
- }
- public function returnCount()
- {
- /*
- * Kaç tane satır
- * çekildi
- */
- if($this->count === false or $this->count==0)
- {
- return 0;
- return "Herhangi bir veri bulunamadı..";
- }
- return $this->count;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement