这是我的问题。我一直在将数据保存到数据库,然后显示该错误。
错误消息
“消息:函数参数太少 Model_properties :: declare_existing_save(),传入了32个 C:\ xampp \ htdocs \ amilyar \ application \ controllers \ Applicant_properties.php 在第113行,预期恰好是38”
这是我在Model_properties下的代码
public function declare_existing_save($email,$tdn,$pin,$owner_name,$owner_address,$admin_name,$admin_address,$prop_no_street,$prop_barangay,$prop_province,$prop_cert,$prop_cadastral,$prop_ass_lot,$prop_bnorth,$prop_beast,$prop_bwest,$prop_bsouth,$with_ia,$ia_ow_total,$ia_as_total,$with_ib,$ib_ow_total,$ib_as_total,$with_ii,$ii_ow_total,$ii_as_total,$with_iiia,$iiia_ow_total,$iiia_as_total,$with_iiib,$iiib_ow_total,$iiib_as_total,$prop_id,$kind,$use,$mvalue,$level,$value){
$sql = "INSERT INTO amilyar_properties (
email,
prop_record_type,
prop_tdn,
prop_pin,
prop_owner,
prop_owner_address,
prop_name_of_admin,
prop_name_of_admin_address,
prop_no_street,
prop_barangay,
prop_province,
prop_certificate_title_no,
prop_cadastral_lot_no,
prop_assessor_lot_no,
prop_bound_north,
prop_bound_east,
prop_bound_west,
prop_bound_south,
prop_type_IA,
ia_total,
ia_as_total,
prop_type_IB,
ib_total,
ib_as_total,
prop_type_II,
ii_total,
ii_as_total,
prop_type_IIIA,
iiia_total,
iiia_as_total,
prop_type_IIIb,
iiib_total,
iiib_as_total,
prop_approved,
date_created
) VALUES (
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?,
?
)";
$data = array(
$email,
2,
$tdn,
$pin,
$owner_name,
$owner_address,
$admin_name,
$admin_address,
$prop_no_street,
$prop_barangay,
$prop_province,
$prop_cert,
$prop_cadastral,
$prop_ass_lot,
$prop_bnorth,
$prop_beast,
$prop_bwest,
$prop_bsouth,
$with_ia,
$ia_ow_total,
$ia_as_total,
$with_ib,
$ib_ow_total,
$ib_as_total,
$with_ii,
$ii_ow_total,
$ii_as_total,
$with_iiia,
$iiia_ow_total,
$iiia_as_total,
$with_iiib,
$iiib_ow_total,
$iiib_as_total,
0,
today()
);
$this->db->query($sql,$data);
return $this->db->insert_id();
$sql = "INSERT INTO `amilyar_declaration_assessment`(`prop_id`, `asm_kind`, `asm_use`, `asm_mvalue`, `asm_level`, `asm_value`, `enabled`) VALUES (?,?,?,?,?,?,?)";
$data = [$prop_id,$kind,$use,str_replace(",","",$mvalue),$level,str_replace(",","",$value),1];
$query = $this->db->query($sql,$data);
return $this->db->affected_rows();
}
谢谢。
答案 0 :(得分:0)
控制器:
$createProperties = $this->Model_properties->createProperties(
array(
'email' => $email,
'prop_record_type' => $prop_record_type,
'prop_tdn' => $prop_tdn,
'prop_pin' => $prop_pin,
'prop_owner' => $prop_owner,
'prop_owner_address' => $prop_owner_address,
'prop_name_of_admin' => $prop_name_of_admin,
'prop_name_of_admin_address' => $prop_name_of_admin_address,
'prop_no_street' => $prop_no_street,
'prop_barangay' => $prop_barangay,
'prop_province' => $prop_province,
'prop_certificate_title_no' => $prop_certificate_title_no,
'prop_cadastral_lot_no' => $prop_cadastral_lot_no,
'prop_assessor_lot_no' => $prop_assessor_lot_no,
'prop_bound_north' => $prop_bound_north,
'prop_bound_east' => $prop_bound_east,
'prop_bound_west' => $prop_bound_west,
'prop_bound_south' => $prop_bound_south,
'prop_type_IA' => $prop_type_IA,
'ia_total' => $ia_total,
'ia_as_total' => $ia_as_total,
'prop_type_IB' => $prop_type_IB,
'ib_total' => $ib_total,
'ib_as_total' => $ib_as_total,
'prop_type_II' => $prop_type_II,
'ii_total' => $ii_total,
'ii_as_total' => $ii_as_total,
'prop_type_IIIA' => $prop_type_IIIA,
'iiia_total' => $iiia_total,
'iiia_as_total' => $iiia_as_total,
'prop_type_IIIb' => $prop_type_IIIb,
'iiib_total' => $iiib_total,
'iiib_as_total' => $iiib_as_total,
'prop_approved' => $prop_approved,
'date_created' => $date_created
)
);
if($createProperties == false)
{
echo 'Error: createProperties';
}
else
{
echo 'Success: createProperties';
$createDeclaration = $this->Model_properties->createDeclaration(
array(
'prop_id' => $email,
'asm_kind' => $prop_record_type,
'asm_use' => $prop_tdn,
'asm_mvalue' => $prop_tdn,
'asm_level' => $prop_tdn,
'asm_value' => $prop_tdn,
'enabled' => $prop_tdn
)
);
if($createDeclaration == false)
{
echo 'Error: createDeclaration';
}
else
{
echo 'Success: createDeclaration';
}
}
型号:
public function createProperties($post)
{
$return = $this->db->insert('amilyar_properties', $post);
return $return == true ? $this->db->insert_id() : false;
}
public function createDeclaration($post)
{
$return = $this->db->insert('amilyar_declaration_assessment', $post);
return $return == true ? $this->db->insert_id() : false;
}