Welcome Guest, Not a member yet? Register   Sign In
Segment troubles + new problem

Hi all

A word before
Yes, I have red the user docs.
Yes, I tried to solve this on my own, but I can't solve this.

Ok, here we go. I have a fucntion that calls nieuws_bekijk and I have a view file nieuws_bekijk_view.php

Well , when I run the script, it says:

Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined property: Main::$url

Filename: controllers/main.php

Line Number: 62

Quote:Fatal error: Call to a member function segment() on a non-object in C:\UsbWebserver\Root\ciAdmin\system\application\controllers\main.php on line 62

What I need to do ?

The function
function nieuws_bekijk() {
        $this->db->where('nieuwsid', $this->url->segment(3));
        $data['query']= $this->db->get('nieuws');

<!-- Kleine stijlwijziging van het extern stijlbestand -->
<style type="text/css">
.style7 {font-size: 12px; font-weight: bold; font-family: Verdana, Arial, Helvetica, sans-serif; color: #FFFFFF; }
.style16 {
    font-size: 12px;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    color: #000000;
.style17 {color: #000000}

<!-- Login check -->

<?php if(isset($_SESSION['gebruiker'])) { ?>

<?php foreach($query->result() as $row):?>
    <!-- Tabel waar het nieuws instaat. -->
    <table width="100%" border="0">
        &lt;!-- Naam --&gt;
            <td width="31%" bgcolor="#90897a" class="style7"><div align="right">Naam</div></td>
            <td width="69%" bgcolor="#e1ddd9" class="style16">&lt;?php echo $row->admin; ?&gt;</td>
          &lt;!-- Datum --&gt;
            <td bgcolor="#90897a" class="style7"><div align="right">Datum</div></td>
            <td bgcolor="#e1ddd9" class="style16">&lt;?php echo date('D d, F, Y H:i', $row->datum); ?&gt;</td>
        &lt;!-- Onderwerp --&gt;
            <td bgcolor="#90897a" class="style7"><div align="right">Onderwerp</div></td>
            <td bgcolor="#E1DDD9"  class="style16">&lt;?php echo $row->onderwerp; ?&gt;</td>
          &lt;!-- Bericht --&gt;
              <td align="right" valign="top" bgcolor="#90897a" class="style7"><div align="right">Bericht</div></td>
            <td align="left" valign="top" class="style16">&lt;?php echo nl2br($row->bericht); ?&gt;</td>

&lt;?php endforeach; ?&gt;

&lt;!-- Niet ingelogd --&gt;

&lt;?php } else { ?&gt;

        U moet inloggen om deze pagina te bekijken.

&lt;?php } ?&gt;

The segment method is on the uri class, not the url helper. Change

$this->db->where('nieuwsid', $this->url->segment(3));


$this->db->where('nieuwsid', $this->uri->segment(3));

[quote author="parrots" date="1214332947"]The segment method is on the uri class, not the url helper. Change

$this->db->where('nieuwsid', $this->url->segment(3));


$this->db->where('nieuwsid', $this->uri->segment(3));

Thanks it worked

Theme © iAndrew 2016 - Forum software by © MyBB