0
votes

My Model Code :

public function get_news($id)
{

    $this->db->select('*');     
    $this->db->limit(1);        
    $this->db->order_by("id", "desc");
    $this->db->from('news_article');
    $this->db->where('news_article.submenuid', $id);
    $query = $this->db->get();
    $result=$query->result();
    if($result)
    {
        return $result;
    }
    else
    {

        return false;
    }
}

My Controller Code is :

public function get_single_news($id)
{   

    $data=array();
    $data['single']=$this->Syllabus_model->get_news($id);
    var_dump($data['single']);                                  
    $data['maincontent']=$this->load->view('single_news/get_single_news', $data, true);
    $this->load->view('welcome_message',$data);   
}

My View Code is :

<?php

if(!empty($single){
    forech($single as $values){

        ?>
        <?php $values->id;?>

        <?php
    }
}
else
{
    echo "Have Not Data;
}

?>

Data come in controller by var_dump($data['single']);

array(1) { [0]=> object(stdClass)#31 (19) { ["id"]=> string(1) "3" ["Title_B"]=> string(35) "ঈমান ও আকীদার" ["Title_E"]=> string(35) "ঈমান ও আকীদার" ["Title_A"]=> string(35) "ঈমান ও আকীদার" ["short_D_B"]=> string(35) "ঈমান ও আকীদার" ["short_D_E"]=> string(35) "ঈমান ও আকীদার" ["short_D_A"]=> string(35) "ঈমান ও আকীদার" ["long_D_B"]=> string(42) "

ঈমান ও আকীদার " ["long_D_E"]=> string(42) "

ঈমান ও আকীদার " ["long_D_A"]=> string(42) "

ঈমান ও আকীদার " ["imageurl"]=> string(30) "./upload/965757556a5a33d79.jpg" ["slideimage"]=> string(3) "YES" ["imagegallary"]=> string(3) "YES" ["titilerecent"]=> string(3) "YES" ["createdate"]=> string(19) "2016-06-06 18:19:38" ["userid"]=> string(1) "1" ["status"]=> string(1) "0" ["menuid"]=> string(1) "1" ["submenuid"]=> string(3) "120" } }

error Message below

Fatal error: Uncaught TypeError: Argument 1 passed to CI_Exceptions::show_exception() must be an instance of Exception, instance of ParseError given, called in C:\xampp\htdocs\tale23\tale23\system\core\Common.php on line 658 and defined in C:\xampp\htdocs\tale23\tale23\system\core\Exceptions.php:190 Stack trace: #0 C:\xampp\htdocs\tale23\tale23\system\core\Common.php(658): CI_Exceptions->show_exception(Object(ParseError)) #1 [internal function]: _exception_handler(Object(ParseError)) #2 {main} thrown in C:\xampp\htdocs\tale23\tale23\system\core\Exceptions.php on line 190 A PHP Error was encountered

Severity: Error

Message: Uncaught TypeError: Argument 1 passed to CI_Exceptions::show_exception() must be an instance of Exception, instance of ParseError given, called in C:\xampp\htdocs\tale23\tale23\system\core\Common.php on line 658 and defined in C:\xampp\htdocs\tale23\tale23\system\core\Exceptions.php:190 Stack trace: #0 C:\xampp\htdocs\tale23\tale23\system\core\Common.php(658): CI_Exceptions->show_exception(Object(ParseError)) #1 [internal function]: _exception_handler(Object(ParseError)) #2 {main} thrown

Filename: core/Exceptions.php

Line Number: 190

Backtrace:

Please Help me

1
Please post the question properly ? - srinivas
Keep the question standard.Pz do it properly - robins

1 Answers

0
votes

Try commenting or removing the var_dump and $data['maincontent'] lines as shown below:

//var_dump($data['single']); 
//$data['maincontent']=$this->load->view('single_news/get_single_news', $data, true);

I don't think loading a view and pass it to a view is right.