Erreur: Call to undefined method
je développe mon code de connexion, sélection, insertion,.. dans la base de donnée en utilisant MySQLi, j'obtiens l'erreur suivante:
Citation:
Fatal error: Call to undefined method Connexion::query() in classes.php on line 66
voila le code:
classes.php
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
public final function toDo($method='', $fields=array(), $table_name='')
{
// method: select, create, insert, delete, update, read (CRUD)
$this->method = $method;
$this->fields = $fields;
$this->table_name = $table_name;
global $r;
$this->r = $r;
if(!is_object($r)){echo"<font color='red' size='5'>DB N EST PAS UN OBJET</font>";} else {echo 'is object';}
switch($this->method)
{
case 'SELECT':
$this->select = "$this->method $fields FROM $this->table_name";
echo $this->select;
$this->result = $r->query($this->select);
//$this->query = mysql_query($select) OR DIE (mysql_error());
break;
} // EnD switch
} // end toDo |
ligne66: $this->result = $r->query($this->select);
fichier.php:
Code:
1 2 3 4 5 6 7 8 9
|
<?php
include 'classes.php';
$r = new Connexion($db_host, $db_user, $db_passwd);
$r->db_name($db_idara);
$r->toDo('SELECT', '*', 'users_sgroups');
?> |
merci a vous