显示数据库,方法,任何ci助手的查询结果?

UPDATE:

How could/would i be able to display the results. My mind is blocked, i cant seem to think coz all my mind prioritizes is the design/look of how it would be displayed. If someone could show me in code how to display each of the data, i would be able to finish.

I have little to no time to make a better database structure so one table would suffice. :)

Table columns: id name meal cuisine cooking difficulty description

Search View: 1st step

<h2>Results:</h2>

                <?php if($result == 0):?>
                No records found.
            <?php else:?>
                <?php foreach($result as $r):?>
                    <?=anchor('recipe_controller/show_recipe_search/'.$r->id,$r->name);?><br />
                <?php endforeach;?>
            <?php endif;?>
            <p>
                <?=$links?>
            </p>

Controller: 2nd step

public function show_recipe_search()
    {

    $to_show = $this->uri->segment(3);
    $this->db->where('id', $to_Show);
    $query = $this->db->get('recipe');
    $data['result'] = $query->result_array();

    $this->load->view('display_recipe',$data);

    }

View: 3rd step

<?php foreach($result as $r):?>
<h2><?php echo '$name'; ?></h2> // Recipe name
        <?=$r->echo rest of row;?><br />
                <?php endforeach;?>

Since my view is incomplete as my mind is rendering me paralyzed. IDK why. I just cant think of how i would be able to display the result. Should be easy but until i can picture the design i cant echo the results yet.

What does this error imply?

a php error was encountered

severity: notice

message: trying to get property of non-object

filename: views/display_recipe.php

line number: 63

line 63 is <h2><?php echo $r->name; ?></h2>

Your error is generally thrown when an object cannot access a property, due to it being null. I'd imagine that the main idea is that you're not actually returning anything from the DB.

I suspect that your problem is on this line:

$this->db->where('id', $to_Show);

Can you try a var_dump() right after you execute your query or going through XDebug?