PHP - Ayuda Model php

 
Vista:

Ayuda Model php

Publicado por Dairxons (1 intervención) el 29/05/2018 02:17:00
Fatal error: Call to a member function fetch_array() on boolean in L:\AppServ\www\dicoto-centrap\core\controller\Model.php on line 45

ayuda me sale este error

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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
class Model {
 
	public static function exists($modelname){
		$fullpath = self::getFullpath($modelname);
		$found=false;
		if(file_exists($fullpath)){
			$found = true;
		}
		return $found;
	}
 
	public static function getFullpath($modelname){
		return "core/modules/".Module::$module."/model/".$modelname.".php";
	}
 
	public static function many($query,$aclass){
		$cnt = 0;
		$array = array();
 
		while($r = $query->fetch_array()){
			$array[$cnt] = new $aclass;
			$cnt2=1;
			foreach ($r as $key => $v) {
				if($cnt2>0 && $cnt2%2==0){
					$array[$cnt]->$key = $v;
				}
				$cnt2++;
			}
			$cnt++;
		}
		return $array;
	}
 
	public static function one($query,$aclass){
		$cnt = 0;
		$found = null;
		$data = new $aclass;
		while($r = $query->fetch_array()){
			$cnt=1;
 
			foreach ($r as $key => $v) {
				if($cnt>0 && $cnt%2==0){
					$data->$key = $v;
				}
				$cnt++;
			}
 
			$found = $data;
			break;
		}
		return $found;
	}
 
}
 
 
 
?>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Lopez
Val: 395
Bronce
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

Ayuda Model php

Publicado por Lopez (128 intervenciones) el 29/05/2018 22:23:37
Hola Dairxons ,
¿
El modelo existe? ¿El nombre del mismo, es el correcto?
Saludos!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar