CodeIgniter enjoy publication and show how tanned

1

I'm developing a publishing, tanning and rewrite script, but when I put the option to be tanned my error starts.

SE ( ID_PERFIL = ID_PERFIL e ID_PUBLICACAO= ID_PUBLICACAO ) { CURTIU } SE NAO { CURTIR }

But when I make this request in the row_array ()

The result always brings the first one from the list and only the first tanned item appears as tanned, the others do not appear as it enters the denial.

If the first one is 23 , it gets 23 = 23 , the second being 17 , it still gets 23 = 17 and does not appear with tanning.

  

MODEL

public function publicacao_curtida(){
$this->db->select('*, publicacao.id as id_publicacao');
$this->db->from('publicacao');
$this->db->join('user', 'user.id = publicacao.id_profile');
$this->db->join('publicacao_like', 'publicacao.id = publicacao_like.id_publicacao');
$this->db->order_by("publicacao.id DESC");
//$this->db->order_by("rand()");
//$this->db->limit(5);
$query = $this->db->get();
return $query->row_array(); }
  

HTML

        <?php if($this->session->userdata('user_id') == $publicacao_curtida["id_profile"] && $publicacao_curtida["id_publicacao"] == $public->id_publicacao){ ?>
            <a href="#" onclick="descurtir_postagem(<?php echo $public->id_publicacao ?>)"><i class="fa fa-thumbs-up" style="color:#0093D6;"></i> Curtiu</a>
        <?php }else{ ?> 
            <a href="#" onclick="curtir_postagem(<?php echo $public->id_publicacao ?>)"><i class="fa fa-thumbs-up" ></i> Curtir</a>
        <?php } ?>
    
asked by anonymous 09.10.2017 / 00:07

1 answer

0

To get all the results of a query use result_array() or just result() (which returns an array of objects). row_array() return only one result / row of the database.

    
09.10.2017 / 15:00