Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 编辑表单错误;共点火器_Php_Codeigniter_Edit - Fatal编程技术网

Php 编辑表单错误;共点火器

Php 编辑表单错误;共点火器,php,codeigniter,edit,Php,Codeigniter,Edit,我犯了这个错误 遇到一个PHP错误 严重性:通知 消息:未定义的属性:stdClass::$fname 文件名:views/view_editstub.php 电话号码:60 我的看法是: <form method="post" action="<?php echo base_url();?>site/update_stud"> <table> <?php foreach ($user

我犯了这个错误

遇到一个PHP错误

严重性:通知

消息:未定义的属性:stdClass::$fname

文件名:views/view_editstub.php

电话号码:60

我的看法是:

     <form method="post" action="<?php echo base_url();?>site/update_stud">

            <table>

                <?php foreach ($user->result() as $row) { ?>

                <tr>
                    <th scope="row">Enter your first name</th>
                    <td><input type="text" name="fname" size="20" value="<?php echo $row->fname; ?>" /></td>
                </tr>

                <tr>
                    <th scope="row">Enter your last name</th>
                    <td><input type="text" name="lname" size="20" value="<?php echo $row->lname; ?>" /></td>
                </tr>

                <tr>
                    <th scope="row">Enter your contact number</th>
                    <td><input type="text" name="contact" size="20" value="<?php echo $row->contact; ?>" /></td>
                </tr>

                <tr>
                    <th scope="row">Enter your address</th>
                    <td><textarea name="address" rows="5" cols="20"><?php echo $row->address; ?></textarea></td>
                </tr>

                <tr>

                    <td><input type="hidden" name="id" value="<?php echo $row->id; ?>" />
                        <input type="submit" name="submit" value="Update" /></td>
                </tr>

                <?php } ?>

            </table>
这是我的模型:

 public function getById($id) {

    $query = $this->db->get_where('students', array('ID'=>$id));

    return $query;
}
谁能帮我解决这个问题

print($row) 

并检查数组中是否有$fname索引。如果只有此索引不可用,则会导致此问题。

print($row)检查$fname索引是否可用此问题的原因是,如果只有此索引不可用,请在遇到PHP错误后在视图中检查严重性:4096消息:stdClass类的对象无法转换为字符串文件名:views/view_editstub.PHP行号:58放入此
print\r($row);退出
之前
print($row)