0

I m getting an error message on Codeigniter while I m trying to fetch data from the database on line number 10,12,14

<html>
    <head>
        <title>view</title>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/>

    </head>
    <body>
        <h1>Welcome to my view page!</h1>
        <br/>
        <?php echo $title; ?>
        <br/>
        <?php echo $test1; ?>
        <br/>
        <?php echo $model_data; ?>
    </body>
</html>

ERROR is shown after running

enter image description here

2

1 Answer 1

2

You cant get data this way. I assume you got values from database in your model and pass it to this view . Lets say your array name is $result.

<html>
    <head>
        <title>view</title>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"/>

    </head>
    <body>
      <?php 
         foreach($result as $values){
           $title = $values->title;
           $test1 = $values->test1;
         }
       ?>
        <h1>Welcome to my view page!</h1>
        <br/>
        <?php echo $title; ?>
        <br/>
        <?php echo $test1; ?>
        <br/>
    </body>
</html>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.