Help Me

Am currently developing a school management system, but am stack i believe you are the only one who can help in this.

I need to display a cgridview in this format

The php code is like this



$ad=6; //i assumed this to be the amount entered by the accountanty

$a = array(1, 2, 3, 4, 5); //this are assumed to be the item that a student is supposed to pay

foreach ($a as $B)




//echo $b."<br>";?><?php

$sum=$ad-$b; //minus the item amount from the school fees payed

//print "<br>".$b . " <br>";

if ($sum<=0){ //if the result if less or equal to zero the raw cell is automaticaly initialized by zero

    echo (&#036;sum=0).&quot;&lt;br&gt;&quot;;





    else{echo &#036;b.&quot;&lt;br&gt;&quot;;}

$ad=$sum; //the next loop is assign with the result of the current ammount

//echo $ad;



The the entire grid should be saved in the db.

Please how can I achieve this using Cgridview because currently I must say I have no idea on how to go about this in yii


CGridView used to display data from the model(s) (even if you make calculates before the displaying)

If you want to display data from the memory to CGridView the you should use CArrayDataProvider

Please give us the attributes of your model and how you want to displayed each one. (with condition, calculate, etc)