php - Running query inside loop -


good day. i'm trying running query inside loop. here did far.

function scan_folder() {            $this->load->library('word');      $this->load->helper('directory');     $map2 = directory_map('./assets/filenya/hukum acara', true, true);     for($x=0;$x<count($map2);$x++)             {                     $map3 = directory_map('./assets/filenya/hukum acara/'.$map2[$x]);                     for($xy = 0;$xy<count($map3);$xy++)                     {                          $category[$xy] = $this->modelmodel->showsingle("select menu_id kategori                                                                  name '%".stripslashes($map2[$x])."%'");                         echo $map3[$xy]." ".$category[$xy]->menu_id."<br>";                     }             } } 

with script above. error trying property of non-object.

array $map2

array (     [0] => h.i.r\     [1] => kitab undang-undang hukum\ ) 

array $map3

array (     [0] => kolonial_herzien_inlandsch_reglement.pdf ) array (     [0] => kolonial_kuh_perdata_fix.pdf     [1] => kuh dagang.pdf     [2] => kuh pidana.pdf     [3] => kuhap.pdf ) 

and if echo query

echo "select menu_id kategori    name '%".stripslashes($map2[$x])."%' <br>"; 

and here result

select menu_id kategori name '%h.i.r%'  select menu_id kategori name '%kitab undang-undang hukum%'  select menu_id kategori name '%kitab undang-undang hukum%'  select menu_id kategori name '%kitab undang-undang hukum%'  select menu_id kategori name '%kitab undang-undang hukum%' 

here error . i'm using codeigniter 3

kolonial_herzien_inlandsch_reglement.pdf 11 php error encountered

severity: notice

message: trying property of non-object

filename: controllers/admin.php

line number: 31

backtrace:

file: d:\xampp\htdocs\jdih\application\controllers\admin.php line: 31 function: _error_handler

file: d:\xampp\htdocs\jdih\index.php line: 315 function: require_once

kolonial_kuh_perdata_fix.pdf php error encountered

severity: notice

message: trying property of non-object

filename: controllers/admin.php

line number: 31

backtrace:

file: d:\xampp\htdocs\jdih\application\controllers\admin.php line: 31 function: _error_handler

file: d:\xampp\htdocs\jdih\index.php line: 315 function: require_once

kuh dagang.pdf php error encountered

severity: notice

message: trying property of non-object

filename: controllers/admin.php

line number: 31

backtrace:

file: d:\xampp\htdocs\jdih\application\controllers\admin.php line: 31 function: _error_handler

file: d:\xampp\htdocs\jdih\index.php line: 315 function: require_once

kuh pidana.pdf php error encountered

severity: notice

message: trying property of non-object

filename: controllers/admin.php

line number: 31

backtrace:

file: d:\xampp\htdocs\jdih\application\controllers\admin.php line: 31 function: _error_handler

file: d:\xampp\htdocs\jdih\index.php line: 315 function: require_once

kuhap.pdf

give try

for($x=0;$x<count($map2);$x++)             {                     $map3 = directory_map('./assets/filenya/hukum acara/'.$map2[$x]);                     foreach($map3 $file)                     {                          $category = $this->modelmodel->showdata("select menu_id kategori                                                                  name '%".stripslashes($map2[$x])."%'");                          foreach($category $result)                             {                                 echo $file."--".$result->menu_id."<br>";                             }                     }             } 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -