单击视图上的“销售”按钮后出现错误
错误:
遇到未捕获的异常
类型:ArgumentCountError
消息:太少的参数功能猫100::销售(),0传递在C:\xampp\htdocs\catshop 100\system\core\CodeIgniter.php在第532行,正好1预期
文件名:C:\xampp\htdocs\catshop100\application\controllers\Cats100。php
电话号码:61
回溯:
文件:C:\xampp\htdocs\catshop100\index。php
电话号码:315
功能:require_once
控制器:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Cats100 extends CI_Controller {
public function __construct(){
parent::__construct();
$this->load->library('session');
$this->load->helper('url');
$this->load->model('CatsModel100');
$this->load->model('CateModel100');
}
public function index(){
$data['cats100'] = $this->CatsModel100->view();
$this->load->view('kucing/index_cats_100', $data);
}
public function tambah(){
if($this->input->post('submit')){
if($this->CatsModel100->validation("save")){
$this->CatsModel100->save();
if($this->db->affected_rows() > 0){
$this->session->set_flashdata('msg','Cat Successfuly Added');
}else{
$this->session->set_flashdata('msg','Cat Add Failed');
}
redirect('cats100');
}
}
$data['category']=$this->CateModel100->view();
$this->load->view('kucing/form_tambah_cats_100', $data);
}
public function ubah($id){
if($this->input->post('submit')){
if($this->CatsModel100->validation("update")){
$this->CatsModel100->edit($id);
if($this->db->affected_rows() > 0){
$this->session->set_flashdata('msg','Cat Successfuly Edited');
}else{
$this->session->set_flashdata('msg','Cat Edit Failed');
}
redirect('cats100');
}
}
$data['category']=$this->CateModel100->view();
$data['cats100'] = $this->CatsModel100->view_by($id);
$this->load->view('kucing/form_ubah_cats_100', $data);
}
public function hapus($id){
$this->CatsModel100->delete($id);
if($this->db->affected_rows() > 0){
$this->session->set_flashdata('msg','Cat Successfuly Deleted');
}else{
$this->session->set_flashdata('msg','Cat Delete Failed');
}
redirect('cats100');
}
public function sale($id){
if($this->input->post('submit')){
$this->CatModel100->sale($id);
if($this->db->affected_rows() > 0){
$this->session->set_flashdata('msg','<p style="color:black">Cat Succesfully Sold!</p>');
}else{
$this->session->set_flashdata('msg','<p style="color:red">Cat Sale Failed!</p>');
}
redirect('cats100');
}
$data['cats100'] = $this->CatsModel100->view_by($id);
$this->load->view('kucing/cat_sale_100', $data);
}
}
型号:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class CatsModel100 extends CI_Model {
public function view(){
return $this->db->get('cats100')->result();
}
public function view_by($id){
$this->db->where('id_100', $id);
return $this->db->get('cats100')->row();
}
public function validation($mode){
$this->load->library('form_validation');
if($mode == "save")
$this->form_validation->set_rules('input_id', 'ID', 'required|numeric|max_length[10]');
$this->form_validation->set_rules('input_name', 'Nama', 'required');
$this->form_validation->set_rules('input_type', 'Type', 'required');
$this->form_validation->set_rules('input_gender', 'Gender', 'required');
$this->form_validation->set_rules('input_age', 'Age', 'required');
$this->form_validation->set_rules('input_price', 'Price', 'required');
if($this->form_validation->run())
return TRUE;
else
return FALSE;
}
public function save(){
$data = array(
"id_100" => $this->input->post('input_id'),
"name_100" => $this->input->post('input_name'),
"type_100" => $this->input->post('input_type'),
"gender_100" => $this->input->post('input_gender'),
"age_100" => $this->input->post('input_age'),
"price_100" => $this->input->post('input_price')
);
$this->db->insert('cats100', $data);
}
public function edit($id){
$data = array(
"name_100" => $this->input->post('input_name'),
"type_100" => $this->input->post('input_type'),
"gender_100" => $this->input->post('input_gender'),
"age_100" => $this->input->post('input_age'),
"price_100" => $this->input->post('input_price')
);
$this->db->where('id_100', $id);
$this->db->update('cats100', $data);
}
public function delete($id){
$this->db->where('id_100', $id);
$this->db->delete('cats100');
}
public function sale($id){
$data = array(
"customer_name_100" => $this->input->post('customer_name_100'),
"customer_address_100" => $this->input->post('customer_address_100'),
"customer_phone_100" => $this->input->post('customer_phone_100'),
"cat_id_100" => $id
);
$this->db->insert('catsales100', $data);
$this->db->set('sold_100', '1');
$this->db->where('id_100', $id);
$this->db->update('cats100', $sold);
}
}
视图:
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<title>Form Cat Sale - CATSHOP100</title>
</head>
<body style="background-color:aquamarine;">
<nav class="navbar navbar-expand-md bg-dark navbar-dark fixed-top">
<a href="<?=base_url();?>" class="navbar-brand">Catshop100</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="collapsibleNavbar">
<ul class="navbar-nav">
<li class="nav-item">
<a href="<?=site_url('cats100')?>" class="nav-link">Manage Cats</a>
</li>
<li class="nav-item">
<a href="<?=site_url('cat100')?>" class="nav-link">Manage Categories</a>
</li>
<li class="nav-item">
<a href="<?=site_url('user100')?>" class="nav-link">Manage Users</a>
</li>
</ul>
</div>
</nav>
<br><br><br><br>
<?php echo form_open("cats100/sale"); ?>
<div class="container bg-dark text-white" style="width:50%;">
<h2>Form Cat Sales</h2>
<div class="form-group">
<label for="cat id">Cat ID</label>
: <?php echo set_value('input_id', $cats100->id_100); ?>
</div>
<div class="form-group">
<label for="cat name">Cat Name</label>
: <?php echo set_value('input_name', $cats100->name_100); ?>
</div>
<div class="form-group">
<label for="cat type">Cat Type</label>
: <?php echo set_value('input_price', $cats100->type_100); ?>
</div>
<div class="form-group">
<label for="cat price">Cat Price</label>
: $.<?php echo set_value('input_price', $cats100->price_100); ?>
</div>
<div class="form-group">
<label for="customer name">Customer Name</label>
<input type="text" name="customer_name_100" class="form-control">
</div>
<div class="form-group">
<label for="customer address">Customer Address</label>
<textarea name="customer_address_100" id="" class="form-control"></textarea>
</div>
<div class="form-group">
<label for="customer phone">Customer Phone</label>
<input type="text" name="customer_phone_100" class="form-control">
</div>
<div class="form-group">
<input type="submit" name="submit" value="Sale" class="btn btn-success">
<a href="<?=site_url('cats100')?>"><input type="button" value="Batal" class="btn btn-danger"></a>
</div>
</div>
</body>
<html>
请帮我解决这个问题
在代码中
我正在使用CodeIgniter 3制作新闻编辑功能,这里还有一个图像编辑功能 但有如下错误:, 遇到未捕获的异常类型: ArgumentCountError 消息:函数运算符::edit_berita()的参数太少,在D:\xampp\htdocs\ui desa\system\core\CodeIgniter中传递了0。php在第532行,预期正好为1 文件名:D:\xampp\htdocs\
当我的WooCommerce购物车页面为空时,我会在页面上出现此错误,我如何消除此错误消息? 致命错误:未捕获的ArgumentCountError:参数太少,无法执行wc_get_page_id(),0在第30行 /home/s3morder/public_html/wp-content/themes/Intranet主题/伍兹商业/购物车/cart-empty.php中传递,而在 /home/
我得到以下错误: 致命错误:Uncaught ArgumentCounter错误:函数wpdb::prepare()的参数太少,1传入/homepages/39/d740877019/htdocs/test/wp content/themes/eduma/formulaire_get。php位于第108行,在/homepages/39/d740877019/htdocs/test/wp inclu
我知道有一些与此相关的问题,但是有c或其他语言。我得到了这个错误,我不确定我的功能出了什么问题。这是我的错误 致命错误:Uncaught ArgumentCounter错误:函数Admincategory::deletecategory()的参数太少,在F:\xampp\htdocs\digikalamvc\core\app中传递了0。php位于第34行,在F:\xampp\htdocs\digi
我得到以下错误: 致命错误:Uncaught ArgumentCounter错误:参数太少,无法使用wpdb::prepare()函数,第635行的/home/admin/public_html/ocarinatab.com/wp-content/plugins/ocarina-tabs/ocarina-tabs.php中传递了1个,在/home/admin/public_html/ocarina
错误 遇到未捕获的异常类型:RuntimeException消息:无法找到指定的模型:事件文件名:/home/dailysurvive/public_html/citymallgulberglahore。com/mall/system/core/Loader。php行号:344 Backtrace:File:/home/dailysurvive/public_html/citymallgulber