Welcome Guest, Not a member yet? Register   Sign In
help me solve this problem
#1

[eluser]C_Line[/eluser]
Code:
----------
model
----------
function ambilreq(){
$qbidding = $this->db->query("select b.idbidding,b.idrfq,b.txstatbid,b.txnmbid,b.txbidtype
     from bidding b where b.txstatbid = 'open'");
return $qbidding;

-------------
controller
-------------
function daftarbidding(){
$this->load->model("invmod",'',TRUE);
$data['qbidding'] = $this->invmod->ambilreq();
$this->load->view("listbidding",$data);
}

----------
view
----------
$qidbidding = $this->db->query("select count(idbidding) as cnt from joinrequest where idbidding = '$idbidding'")->result_array();
  foreach($qidbidding as $row){
   foreach($row as $key => $val){
    if($val != NULL)
    $jum = $val;                
    }
   }
  
<td>".$idbidding."</td><td>".$i."</td><td>".$namabid."</td><td>".$tipe."</td><td>( ".$jum." / 5 )</td>;

my problem is, i call model from view, i wan move the code that connect to database in view to model but i dun know how to do it, anyone can help me solve this problem, thx before..
#2

[eluser]TheFuzzy0ne[/eluser]
Create a method in your model with a meaningful name, and have it pass back the data you need to your controller, so you can pass it into your view.

I don't quite understand what your app does, so I can't really make a suggestion. Since you're already doing this with one of your queries, I don't understand why you can't with the other.




Theme © iAndrew 2016 - Forum software by © MyBB