• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Accessing database value in view

#4
[eluser]Sumon[/eluser]
If you are using PHP 5 then the most powerful and useful one is using Method Chaining. Use this as common syntax for all of your queries in model.
Code:
$query = $this->db->select('title')
         ->from('mytable as m')
         ->join('comments as c', 'c.id = m.id');
         ->where('m.id', $id)
         ->limit(10, 20)
         ->get();
if ($query->num_rows() > 0)    
{
$row = $query->row(); //For multiple row use $query->result_array()
return $row;
}
else
{
return false;
}


Messages In This Thread
Accessing database value in view - by El Forum - 09-23-2008, 09:43 AM
Accessing database value in view - by El Forum - 09-23-2008, 09:55 AM
Accessing database value in view - by El Forum - 09-23-2008, 10:11 AM
Accessing database value in view - by El Forum - 09-23-2008, 02:10 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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