错误:运行Campaign :: camp_detls()的参数太少,0正好通过了1个预期

i have a table name tbl_campaign_detail in which blogger_ID and Campaign_id are added as a foreign key with some other fields..

i want to delete record from this table.. when i perform delete, it deleted the record but also give an error,

error:

Type: ArgumentCountError

Message: Too few arguments to function Campaign::camp_detls(), 0 passed in D:\XAMPP\htdocs\bms\system\core\CodeIgniter.php on line 532 and exactly 1 expected

Filename: D:\XAMPP\htdocs\bms\application\controllers\Campaign.php

Line Number: 35

it works perfectly but also shows this error...

Here is my model:

public function camp_detl_delete($did){

    $this->db->where('detail_id', $did);
    $this->db->delete('tbl_campaign_detail');
    if($this->db->affected_rows() > 0){
        return true;
    }else{
        return false;
    }
}

Controller:

public function camp_detl_delete($id){
    $result = $this->cm->camp_detl_delete($id);
    if($result){
        $this->session->set_flashdata('success_msg', 'Record deleted successfully');
    }else{
        $this->session->set_flashdata('error_msg', 'Faill to delete record');
    }
    redirect(base_url('campaign/camp_detls/')); //this should be directed to particular id of camp_detls
}

And view:

$did = $cmp->detail_id;
<a href="<?php echo base_url('campaign/camp_detl_delete/' .$did); ?>" onclick="return confirm('Do you want to delete this record?');">
                    <span class="glyphicon glyphicon-trash"></span>
                </a>

but where it shows error mentioned in controller line 35 is:

function camp_detls($id){
    $data['camps'] = $this->cm->camp_detailByID($id);
    $data['campaign'] = $this->cm->getCampaignsById($id);
    $data['blogger'] = $this->cm->getAllBloggers();
    $data['cat'] = $this->cm->getAllCategory();
    $this->load->view('layout/header');
    $this->load->view('campaign/campaign_detail', $data);
    $this->load->view('layout/footer');
}

Kindly help, how can i remove this error ? i just want it delete simply.

duanqian1888
duanqian1888 亚历克斯其实是一个内页...外页也是基于id..所以我想我可以删除记录并显示页面..
接近 2 年之前 回复
dongyuan6949
dongyuan6949 感谢Bro...base_url('campaign/camp_detls/'。$id)这件事有效
接近 2 年之前 回复
doujingxi3356
doujingxi3356 我不明白//这应该指向camp_detls的特定id...你说要删除id为1的记录,记录现在已删除,你为什么要回到id1?它不在了。
接近 2 年之前 回复
dongmei2351
dongmei2351 你能提供调用camp_detls()的代码吗?这是错误引用的方法。
接近 2 年之前 回复

1个回答




消息:函数Campaign :: camp_detls()的参数太少,0
传递(...) </ p>
</ blockquote>

此错误对您来说意味着您定义的函数( camp_detls()</ code>)和 $ id </ code >因为参数没有通过。</ p>

我认为问题在于:</ p>

  redirect(base_url('campaign / camp_detls /  “));  //这应该指向camp_detls 
</ code> </ pre>

的特定id作为评论提示它,但是看看。 在这里,您希望重定向到特定的 camp_detls </ code>,但不提供 $ id </ code>。</ p>
</ div>

展开原文

原文

Message: Too few arguments to function Campaign::camp_detls(), 0 passed (...)

This error means for you that to the function (camp_detls()) you defined and required $id as argument was nothing passed.

I suppose the problem is in the line:

redirect(base_url('campaign/camp_detls/')); //this should be directed to particular id of camp_detls

as comment suggesting it, but look. Here you want to redirect to particular camp_detls but you do not provide $id.

douli4337
douli4337 谢谢......它有效..
接近 2 年之前 回复
dsrnwngq411594
dsrnwngq411594 你能尝试使用base_url('campaign / camp_detls /'。$ id)吗?
接近 2 年之前 回复
dscpg80066
dscpg80066 简单地说:按下删除它删除了记录,但仍然在页面上记录显示,直到我刷新页面...
接近 2 年之前 回复
doubang9906
doubang9906 我在这里添加了像redirect一样的刷新(base_url('campaign / camp_detls /','refresh')); 但现在它不显示错误并完美删除记录。 但是当我按下删除按钮时,它只会刷新页面...
接近 2 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐