Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: do czego ta funkcja
Forum PHP.pl > Forum > PHP
bialy1500
mam oto takie cos:


<?php

define("PERSIST", 1);
define("TEMP", 0);

class MysqlDB
{

var $connection;
var $status;
var $login;
var $pass;
var $address;
var $database;


function MysqlDB($con_type = TEMP) {
require("confdb.php");
$this->address = $address;
$this->login = $login;
$this->pass = $pass;
$this->database = $db;
if ($con_type == TEMP) $this->connection = mysql_connect($this->address, $this->login, $this->pass);
else $this->connection = mysql_pconnect($this->address, $this->login, $this->pass);
if (!$this->connection) $this->status = mysql_error();
else {
if (mysql_select_db($this->database, $this->connection))
$this->status = "Connected to database ".$this->database;
else $this->status = mysql_error();
}
}


function is_connected() {
if ($this->connection != "") {
$this->status = "Connected";
return true;
}
else {
$this->status = "Not connected!";
return false;
}
}

function query ($qe,$one=0) {
$tmp = NULL;
if ($this->is_connected()) {
$tmp = mysql_query($qe, $this->connection);
if ($tmp) $this->status = "Query executed";
else $this->status = mysql_error();
if ($one == 1) {
$tmp = mysql_fetch_array($tmp);
list($key, $value) = each($tmp);
$tmp = $value;
}
}
return $tmp;
}

function query_numrows ($qer) {
$tmp = $this->query ($qer);
if ($tmp) return mysql_num_rows($tmp);
else return NULL;
}

function query_affected_rows ($qer) {
$this->query ($qer);
return mysql_affected_rows($this->connection);
}

function insert_id() {
return mysql_insert_id($this->connection);
}

function close() {
mysql_close($this->connection);
}

}
?>
wiem ze to jest funkcja, ale jak by sie ktos orientowal to o dokladnie jej wyjasnienie co robi itp. z gory dziekuje
Piniek
obsluga bazy danych winksmiley.jpg
bialy1500
no tego sie domyslilem laugh.gif ale moze jakos dak bardziej dosadnie co za co odpowiada??
phpion
Odpowiada za obsługę bazy danych.
Piniek
po nazwach funkcji popatrz to sie domyslisz
bim2
i po drugie to klasa z funkcjami smile.gif Taka nakładka na funkcje mysql_* :]
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.