• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Show a register database.

#1
[eluser]Browser[/eluser]
Hello, i want to show a register of database.

return $query->result();

How can i show it without to used a foreach ?

In a foreach i use $query as $q { echo $q->total; }

#2
[eluser]ChrisMiller[/eluser]
Not sure of your question exactly but do you mean something like this?

Code:
$result = $query->result_array();
for ($i=0; $i<count($result); $i++)
{
    echo $result[ $i ]['sqltable_field_name'];
}

or

Code:
$result = $query->result();
foreach ($result as $row)
{
    echo $row->sqltable_field_name;
}

If this is not what you are looking for maybe you could explain your question a little better.

#3
[eluser]guidorossi[/eluser]
I think you're looking for something like:

Code:
$this->db->select('name, age');
$this->db->where('gender', $gender);
$query = $this->db->get('peope');

if ($query->num_rows() > 0)
{
$queryresult = $query->result_array();


$name = $queryresults['0']['name']; //0 to get only the first or unique

}


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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