当我将行更新到数据库时出现错误。
我的问题不是更新行并在我上传图片时调用我更新文件上传未在索引中定义。
我的控制器:
public function addedit(){
    $events = new events_model();
    $prodID = $this->input->post('hID');
    $text = $this->input->post('ev_text');
    $pic = $this->do_upload('ev_pic');
    $submit = $this->input->post('submit');
    if($submit){
        if(!empty($prodID)){
            $this->data['events'] = $events->UpdatePost($prodID, $text , $pic );
            $this->data['pagetitle'] = "Show Info";             
            $this->data['success']= "Update Done";
        }else{
            $this->data['success'] = "Add Done";
        }
    $this->data['status'] = "1";
    }else{
        $this->data['status'] = "0";
        $this->data['errors'] = "Error";
    }
    $this->template->build('admin/events/add',$this->data);
}
和型号:
function UpdatePost($prodID, $text , $pic ) {
    if ($pic == ""){
        $vales = array('ev_id' => $prodID , 'ev_text' => $text);
    }else{
        $vales = array('ev_id' => $prodID , 'ev_text' => $text , 'ev_pic' => $pic);
    }
    $query = $this->db->update($this->table_name, $vales) or die (mysql_error());
    $result = array();
    $result["process"] = "ok";
    echo "1";       
}
并查看:
<div class="widget-body">
            <table class="data-table" action="./administrator/categories/delete/"><!-- Table Conversion: See Section E in custom.js -->
                <thead>
                    <tr>
                        <th class="sorting no-background" rowspan="1" colspan="1" style="width: 35px;"><input type="checkbox" id="checkall" /></th>
                        <th class="sorting" rowspan="1" colspan="1" style="width: 343px;">Tittle</th>
                        <th class="sorting" rowspan="1" colspan="1" style="width: 100px;">Date</th>
                        <th class="sorting no-background" rowspan="1" colspan="1" style="width: 70px;">#</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $ctr = 0; ?>
                    <?php foreach ($events as $n): ?>
                            <tr>
                                <td><input class="checkrow" type="checkbox" value="<?php echo $n->ev_id; ?>" /></td>
                                <td class=" sorting_1"><?= $n->ev_text; ?></td>
                                <td class="center"><?= $n->ev_date; ?></td>
                                <td>
                                    <a href="<?php echo $this->page_url; ?>/edit/<?php echo $n->ev_id; ?>" class="ico-btn ico-text-edit" title="Edit"><span>Edit</span></a>
                                    <a href="<?php echo $this->page_url; ?>/delete/<?php echo $n->ev_id; ?>" itemID="<?= $n->ev_id ?>" class="ico-btn ico-text-trash opener-delete" title="Del"><span>Del</span></a>
                                </td>
                            </tr>
                    <?php endforeach ?>
                </tbody>
            </table>
            <div class="clear"></div>
        </div>
         <div class="clear"></div>
    </div>
    <div id="table-extra">
        <div id="table-action">
            <input action="./administrator/<?php echo $this->uri->segment(2)."/deleteitems" ?>" class="btn-theme table-button btn-hover-black DeleteItems" id="submit" type="button" value="Delete" />
        </div>
        <div class="paginate">
            <ul>
                <?= $this->pagination->create_links(); ?>
            </ul>
            <div class="clear"></div>
        </div>
        <div class="clear"></div>
    </div>
</div>
</div>
我的代码哪里有问题,我不会更新成功。