bonjour,
j'ai un problème de Doublon avec la classe pour les base de donnée que j'utilise. Je n'arrive pas a trouver d'ou cela viens mais j'obtiens sur chaque querry le double de la taille normale du tableau ( la moitié contient des clé alphnumérique, l'autre la meme chose mais avec des clé numérique )
voici ma classe :
class MySQL_class {
var $db, $id, $result, $rows, $data, $a_rows;
var $user, $pass, $host;
function MySQL_class () { //constructeur
$this->user = "root";
$this->pass = "";
$this->host = "localhost";
$this->db = "test";
$this->id = @mysql_pconnect($this->host, $this->user, $this->pass);
$this->selectdb($this->db);
}
function SelectDB ($db) {
@mysql_select_db($db, $this->id);
}
# Use this function if the query will return multiple rows. Use the Fetch
# routine to loop through those rows.
function Query ($query) {
$this->result = @mysql_query($query, $this->id);
$this->rows = @mysql_num_rows($this->result);
$this->a_rows = @mysql_affected_rows($this->id);
}
# Use this function if the query will only return a
# single data element.
function QueryItem ($query) {
$this->result = @mysql_query($query, $this->id);
$this->rows = @mysql_num_rows($this->result);
$this->a_rows = @mysql_affected_rows($this->id);
$this->data = @mysql_fetch_array($this->result);
return($this->data[0]);
}
# This function is useful if the query will only return a
# single row.
function QueryRow ($query) {
$this->result = @mysql_query($query, $this->id);
$this->rows = @mysql_num_rows($this->result);
$this->a_rows = @mysql_affected_rows($this->id);
$this->data = @mysql_fetch_array($this->result);
return($this->data);
}
# ajouter pour récupérer un objet afin de l'affecter à une variable de session
# utile pour récupérer les privilèges utilisateur, vérifiés simplement avec $user->priv
function QueryObject ($query) {
$this->resultat = @mysql_query($query, $this->id);
$this->objet = @mysql_fetch_object($this->resultat);
return($this->objet);
}
function Fetch ($row) {
@mysql_data_seek($this->result, $row);
$this->data = @mysql_fetch_array($this->result);
}
merci d'avance,
Dyr3e