Maikomania
Mitglied
Hi Liebe Leute,
nun ist es soweit das ich mich auch mict pdo beschäftigen will möchte muss, da es ja eigentlich schon mehr oder weniger ein muss ist.
Meine Mysql Db auf standartbasis funktioniert einwandfrei nur muss ich das nun für pdo umschreiben kann mir da jemand helfen.
Das ist Sie die normale ohne pdo
nun ist es soweit das ich mich auch mict pdo beschäftigen will möchte muss, da es ja eigentlich schon mehr oder weniger ein muss ist.
Meine Mysql Db auf standartbasis funktioniert einwandfrei nur muss ich das nun für pdo umschreiben kann mir da jemand helfen.
PHP:
class db{
private $connection = NULL;
private $result = NULL;
private $counter=NULL;
public function __construct($host=NULL, $database=NULL, $user=NULL, $pass=NULL){
$this->connection = mysql_connect($host,$user,$pass,TRUE);
mysql_select_db($database, $this->connection);
}
public function disconnect() {
if (is_resource($this->connection))
mysql_close($this->connection);
}
public function query($query) {
$this->result=mysql_query($query,$this->connection);
$this->counter=NULL;
}
public function row() {
return mysql_fetch_assoc($this->result);
}
public function xarray() {
return mysql_fetch_array($this->result);
}
public function numrows() {
return mysql_num_rows($this->result);
}
public function count() {
if($this->counter==NULL && is_resource($this->result)) {
$this->counter=mysql_num_rows($this->result);
}
return $this->counter;
}
}