Jump to content
  • ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

  • Similar Content

    • By WEBCHARLES
      MEU MODEL

      public function exibir_noticia() {

      $consulta = $this->db->query('
      SELECT *
      FROM Noticia_Site_Cairu

      ');
      return $consulta->result();
      }

      NO MEU CONTROLLER:

      public function index()

      {
      $this->load->model('noticia_model');
      $consulta = $this->noticia_model->exibir_noticia();
      //print_r($casdatrado);
      $this->load->view('v_home', $consulta);
      }

      Quando vou exibir na view:


      foreach ($consulta as $exibir):{
      echo '
      <tr class="success">
      <td>'.$exibir->titulo.'</td>
      <td>'.$exibir->texto.'</td>
      <td>'.$exibir->imagem.'</td>
      <td>'.$exibir->link.'</td>
      <td>'.$exibir->nome_link.'</td>
      <td>'.$exibir->video.'</td>
      <td>'.$exibir->data.'</td>
      </tr>';
      }endforeach;

      APARECE ESSE ERRO:

      A PHP Error was encountered

      Severity: Notice

      Message: Undefined variable: consulta

      Filename: views/v_home.php

      Line Number: 88

      Backtrace:

      File: /var/www/html/admnoticias/application/views/v_home.php
      Line: 88
      Function: _error_handler

      File: /var/www/html/admnoticias/application/controllers/Home.php
      Line: 17
      Function: view

      File: /var/www/html/admnoticias/index.php
      Line: 315
      Function: require_once

×

Important Information

Ao usar o fórum, você concorda com nossos Terms of Use.