• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to output MySQL query results?

#2
[eluser]mironcho[/eluser]
In the DB class already exists result_array() method, so you can do:
Code:
$ret = array();

$query = $this->db->query("SELECT example FROM slang WHERE `slang` =' $slang_input' ");
if ($query->num_rows() > 0)
{
    // use result() for array of objects
    // $ret = $query->result();

    // use result_array() for array of arrays
    $ret = $query->result_array();
}

return $ret;

and then loop through it in your view.


Messages In This Thread
how to output MySQL query results? - by El Forum - 07-10-2008, 10:53 PM
how to output MySQL query results? - by El Forum - 07-11-2008, 01:00 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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