Welcome Guest, Not a member yet? Register   Sign In
Entity class - loop 20 rows and iterate through columns in view
#5

(This post was last modified: 08-28-2021, 04:01 AM by Corsari.)

(08-27-2021, 11:51 AM)ikesela Wrote: I try it and got answer :

PHP Code:
foreach ($tRows as $tKey):
        echo "<tr>";
      $tnewKey $tKey->jsonSerialize(); 
        foreach ($tnewKey as $key => $value){
            echo "<td>";
            echo $value;
            echo "</td>";
        }

        echo "</tr>";                        
    
endforeach; 

hello, as stated above, I tried it and it works ... though one weird thing happen


model
PHP Code:
public function listTickets($quantity$offset)
 {

 
$ticketModel = new TicketModel();

 
$data $ticketModel->findAll($quantity$offset);
      
        
return $data;




controller
PHP Code:
public function list($quantity$offset)
 {

 
$ticketModel = new TicketModel();

 
$ticketData $ticketModel->listTickets($quantity$offset);

 
$data = [];

 
$data['tRows'] = $ticketData;

 return 
view("Home/index"$data);

 } 

depite I browse myapp.local/home/list/25/0

they are printed ALL the 300 rows of records in the database

I mean, the resulting HTML table, doesn't have 25 rows, instead it has 300 rows

Wondering: how is this possible?.
Whilst if I use the original code at the begin of this thread, they only prints the expected 25 rows .. really confused about this behavior
Reply


Messages In This Thread
RE: Entity class - loop 20 rows and iterate through columns in view - by Corsari - 08-28-2021, 03:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB