• 18-07-2020, 13:29:36
    #1
    Kimlik doğrulama veya yönetimden onay bekliyor.
    Makaleleri düzenleyebileceğim bir fonksiyon oluşturdum. Ancak "Message: Trying to get property 'n_title' of non-object " hatasını alıyorum. Makale başlığı veritabanımda "n_title" olarak tanımlı. Veritabanımda veri de var ancak yinede bu hata dönüyor.

    Hatanın çıktısı:
    A PHP Error was encountered

    Severity: Notice
    Message: Trying to get property 'n_title' of non-object
    Filename: admin/editnews.php
    Line Number: 23
    Backtrace:
    File: C:xampphtdocsapplicationviewsadmineditnews.php
    Line: 23
    Function: _error_handler
    File: C:xampphtdocsapplicationcontrollersAdminpanel.php
    Line: 94
    Function: view
    File: C:xampphtdocsindex.php
    Line: 315
    Function: require_once
    ">

    editnews.php dosyasında başlık kısmına yazdığım kod:
    <input type="text" name="n_title" class="form-control" required placeholder=" <?php echo $inf->n_title ?> ">
    Function dosyasına girdiğim kod:
    public function editnews($id)
    {
    $this->load->model('vt');
    $inf=$this->vt->newsinfo($id);
    $data['inf']=$inf;
    $this->load->view('admin/editnews',$data);
    
    }
    oluşturduğum model 'vt' deki kod:

          function newsinfo($uname)
    {
        $result=$this->db->select('*')
        ->from('news')
        ->where('n_id',$uname)
        ->get()
        ->result();
        if(count($result)!= 1)
        {
            return false;
        }else
        {
            return $result;
        }
          }
    Nerede hata yapıyorum, yardımcı olur musunuz?
  • 18-07-2020, 22:33:49
    #2
    https://kodyapistir.com/qn6x1Uz04K

    Şu şekilde deneyip haber verirmisin ona göre düzenleme yaparız.