View record of bd by id in a modal foundation 5 (pop-up)

1

The frameworks I'm using are Zurb Foundation 5 and Codeigniter.

How to display in a modal foundation 5 database information per ID? Actually I have already performed the procedure, but I can not display the record by ID.

Displaying records with the Reveal Modal link:

 <?php
    $query = $this->protocolo->get_all_protocolo()->result();
    foreach ($query as $linha):
        echo '<tr>';
        printf('<td class="text-center">%s</td>', $linha->id);
        printf('<td class="text-center">%s</td>', $linha->nome);
        printf('<td class="text-center">%s</td>', $linha->numerodocumento);
        printf('<td class="text-center">%s</td>', anchor("protocolo/gerenciar/$linha->id", 'Observação', 'data-reveal-id="firstModal"'));
        printf('<td class="text-center">%s</td>', anchor('#', 'Detalhes', 'class="addimg"'));
        printf('<td class="text-center">%s</td>', 'Status');                
        echo '</tr>';
    endforeach;
 ?>

Form:

 <?php
    $iduser = $this->uri->segment(3);
    $querys = $this->protocolo->get_byid($iduser)->row();
    echo '<div id="firstModal" class="reveal-modal small" data-reveal>';
    echo '<div class="row">';
    echo '<div class="small-8 columns">';
    echo form_open('#');
    echo form_fieldset('Observação');
    echo form_label('Protocolo');
    echo form_input(array('name' => 'protocolo', 'class' => 'five', 'disabled' => 'disabled'), set_value('protocolo', $querys->id));
    echo form_label('Observação');
    echo form_textarea(array('name' => 'texto', 'class' => 'five'));
    echo '<div class="row">';
    echo '<div class="small-2 columns">';
    echo form_submit(array('name' => 'cadastrar', 'class' => 'button radius small font'), 'Salvar dados');
    echo '</div>';
    echo '</div>';
    echo '</div>';
    echo '</div>';
    echo '<a class="close-reveal-modal">&#215;';
    echo '</div>';
    break;

This way it gives me an error when I go to the manage screen (locahost / system / protocol / manage):

  

Fatal error: Call a member function row () on a non-object.

I think this error is because I'm calling a modal that has a parameter, in this case the id of the user. How can I resolve this problem?

    
asked by anonymous 18.12.2014 / 00:53

1 answer

0

Let's look at the error:

  

Fatal error: Call a member function row () on a non-object.

The error says that row() is being called on a non-object, which would be the protocol searched by the $this->protocolo->get_byid($iduser) method. Of the two, one:

  • The variable $iduser is not being received in the modal, or

  • The variable $iduser is being received, but there is no protocol with that number.

In addition, it has the fact that $iduser comes from the URL, through the $this->uri->segment(3) call. See if this is indeed the best way to get the URI value.

    
18.12.2014 / 12:23