• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
display query result

#1
[eluser]li9ht[/eluser]
Code:
$sql5=$this->db->select_sum('total','total');
      $sql5=$this->db->where('date',"2008-11-22");
      $data['d22']=$this->db->get('sale',$sql5);

how do i output the result..

i've been using this code to output the result.. but the result is only 1 column result.. i dont see y i have to use foreach..but i dont know how to output a single result...
Code:
foreach($d22->result() as $d22a){
echo $d22a->total;
}

how do i output a single result.

#2
[eluser]JoostV[/eluser]
Lots of way to do that:
http://ellislab.com/codeigniter/user-gui...sults.html

#3
[eluser]gullah[/eluser]
you can use
Code:
$row = $d22->r0w();
echo $row->fieldname;

#4
[eluser]hyperfire[/eluser]
try


Code:
$this->db->select_sum('total');
        $this->db->where('date',"2008-11-22");
        $q = $this->db->get('sale');
        $result = $q->result();
        print_r($result);
        
        foreach($result as $key){
            echo $key->total;
        }

#5
[eluser]li9ht[/eluser]
ok thx..


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.