Error: A PHP Error was encountered
Severity: Warning
Message: Missing argument 1 for Skill::delskill()
Filename: controllers/Skill.php
Line Number: 75
Backtrace:
File: /var/www/html/tatui/application/controllers/Skill.php
Line: 75
Function: _error_handler
File: /var/www/html/tatui/index.php
Line: 292
Function: require_once
//
這裏的代碼,其餘代碼工作完美如何調試「缺少參數1 for Skill :: delskill」?
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Skill extends CI_Controller
{
function __construct()
{
parent::__construct();
//$this->load->library('session');
$this->load->helper(array('form', 'url', 'html'));
$this->load->library('form_validation');
}
public function construct_pages($page, $data) {
$this->load->view('templates/header', $data);
$this->load->view('pages/'.$page);
$this->load->view('templates/footer');
}
// checks login using in built validation
public function index()
{
$this->load->helper('form');
$this->load->view('pages/AddSkill');
}
public function skill_validate(){
$this`enter code here`->load->library('form_validation');
$this->form_validation->set_rules('skillid', 'skillid', 'required|max_length[15]');
$this->form_validation->set_rules('skillname', 'SkillName', 'required|max_length[25]');
$this->form_validation->set_rules('skilldescription', 'skilldescription', 'required|max_length[70]');
$this->form_validation->set_rules('skillgroup', 'skillgroup', 'required');
if($this->form_validation->run()){
$this->load->model('Getskills', '', TRUE);
$skill = $this->input->post('skillid');
$skillExisted = $this->Getskills->getskill($skill);
if($skillExisted){
echo "Skill Already Existed";
$this->load->helper('form');
$this->load->view('pages/AddSkill');
}
else{
$data = array(
'SkillId' => $this->input->post('skillid'),
'SkillDescription' => $this->input->post('skilldescription'),
'SkillGroup' => $this->input->post('skillgroup'),
'SkillName' => $this->input->post('skillname')
);
$inserted = $this->Getskills->insert_skill($data);
if($inserted){
echo "Inserted Successfully";
$this->load->view('pages/AddSkill');
}
else{
echo "Please contact Support Team";
}
}
}
else{
echo "Please contact Support Team";
}
}
這部分工作不正常?
public function delskill($data) {
$this->db->where(array('Skillid' , 'Skillname' , 'Skillgroup' , 'Skilldescription'));
$this->db->delete('Skills');
}
}
有人知道它不起作用的實際原因嗎?
你最後的功能delskill($ data)你爲什麼需要?請告訴我 –
消息說'$ data'不在您點擊的鏈接中提供。檢查呈現頁面的視圖文件或視圖源,以瞭解創建的鏈接。第二個問題是您的查詢builer刪除方法。研究[本指南](http://www.codeigniter.com/userguide3/database/query_builder.html#deleting-data)該代碼部分的外觀應該如何。 – Tpojka
請嘗試在這裏使用有用的標題描述你的問題,並避免txtspk - 「我有一個錯誤plz幫助我」爲編輯創建一些工作來解決。 – halfer