单击出厂名称时,在页面上显示1个工厂(个人)

时间:2022-10-06 16:23:34

i have a searchfunction for factories. when i search for a factory and click on the name (a hyperlink) i want to show the individual factory on a new page.

我有工厂的搜索功能。当我搜索工厂并点击名称(超链接)时,我想在新页面上显示各个工厂。

You can see it here: http://kees.een-site-bouwen.nl/home/searchresults

你可以在这里看到:http://kees.een-site-bouwen.nl/home/searchresults

The view for this link is:

此链接的视图是:

<div id="bigcontent">
<h2>Zoekresultaten:</h2>
<br /> <br />
<table>
<tr><th>Bedrijf</th><th>Adres</th><th>Postcode</th><th>Plaats</th><th>Website</th><th>Email</th></tr>
<hr>
<br /> <br />

 <?php foreach($query as $item):?>
 <tr>
  <td><a href="<?php echo base_url()?>home/showindividueel/<?php echo $item->idbedrijven?>"><?= $item->Bedrijfsnaam   ?></td>
   <td><?= $item->Adres ?></td>
    <td><?= $item->Postcode ?></td>
    <td><?= $item->Plaats ?></td>
    <td><?= $item->Website ?></td>
     <td><?= $item->Email ?></td>
     </tr>
 <?php endforeach;?>

</table>

<br /> <br />
<hr>
<br />
<<<a href="<?php echo base_url('home/search') ?>">Terug</a>
</div>

The controller function:

控制器功能:

    function showindividueel($id)
    {
        $data['query'] = $this->bedrijven_model->get_result($id);
        $this->load->view('header');
        $this->load->view('table_individual',$data);
        $this->load->view('footer');
    }

My model function:

我的模特功能:

function get_result($id)
{
    $this->db->select('*');
    $this->db->from('bedrijven');

    $this->db->where('idbedrijven', $id);
    $result = $this->db->get();
    return $result; 
}

My view to show the individual factory:

我的观点是展示个别工厂:

<div id="bigcontent">
<table>
<tr><th>Adres</th><th>Postcode</th><th>Plaats</th><th>Website</th><th>Email</th></tr>
<hr>
<br /> <br />

 <?php foreach($query as $item):?>
   <tr>
 <td><?= $item->Bedrijfsnaam ?></td>
 <td><?= $item->Adres ?></td>
 <td><?= $item->Postcode ?></td>
 <td><?= $item->Plaats ?></td>
 <td><?= $item->Website ?></td>
 <td><?= $item->Email ?></td>
 </tr>
 <?php endforeach;?>

  </table>
</div>

I get the error shown here: http://kees.een-site-bouwen.nl/home/showindividueel/1

我收到错误:http://kees.een-site-bouwen.nl/home/showindividueel/1

My factory table has as the primary key idbedrijven. with auto-increment.

我的工厂表有主键idbedrijven。自动增量。

what am i missing?

我错过了什么?

thanks

1 个解决方案

#1


0  

return $result->result();

In the model.

在模型中。

#1


0  

return $result->result();

In the model.

在模型中。