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
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


0