While submitted form I am getting this error in codeigniter
severity: Warning
Message: mysqli_query() expects at least 2 parameters, 1 given
Filename: models/Login_model.php
Line Number: 50
Backtrace:
File: /opt/lampp/htdocs/zemco/application/models/Login_model.php
Line: 50
Function: mysqli_query
File: /opt/lampp/htdocs/zemco/application/controllers/Stock_main.php
Line: 42
Function: addCustomerDb
File: /opt/lampp/htdocs/zemco/index.php
Line: 292
Function: require_once
Controller:
public function __construct()
{
parent::__construct();
$this->load->library('session');
$this->load->helper('form');
$this->load->helper('url');
$this->load->helper('html');
$this->load->database();
//load the login model
$this->load->model('Login_model');
}
public function addCustomer(){
$result = $this->Login_model->addCustomerDb();
}
Model:
public function addCustomerDb(){
echo "INSERT INTO `tbl_customer` (customer_company_name, customer_primary_address1, customer_primary_address2, customer_primary_country, customer_primary_state, customer_primary_city, customer_primary_poboxno, customer_secondary_address1, customer_secondary_address2, customer_secondary_country, customer_secondary_state, customer_secondary_city, customer_secondary_poboxno, customer_landline, customer_fax, customer_internal_notes, customer_invoice_flag, customer_created_time, customer_created_by) VALUES('$comName', '$primaryAddressstreet1', '$primaryAddressstreet2', '$country1', '$state1', '$cityName1', '$poibox1', '$secondaryAddressstreet1', '$secondaryAddressstreet2', '$country2', '$state2', '$cityName2', '$poibox2', '$businessPhone', '$faxNumber', '$internalNotes', '$emailvia', '$createdOn', '1')";
$query = mysqli_query("INSERT INTO `tbl_customer` (customer_company_name, customer_primary_address1, customer_primary_address2, customer_primary_country, customer_primary_state, customer_primary_city, customer_primary_poboxno, customer_secondary_address1, customer_secondary_address2, customer_secondary_country, customer_secondary_state, customer_secondary_city, customer_secondary_poboxno, customer_landline, customer_fax, customer_internal_notes, customer_invoice_flag, customer_created_time, customer_created_by) VALUES('$comName', '$primaryAddressstreet1', '$primaryAddressstreet2', '$country1', '$state1', '$cityName1', '$poibox1', '$secondaryAddressstreet1', '$secondaryAddressstreet2', '$country2', '$state2', '$cityName2', '$poibox2', '$businessPhone', '$faxNumber', '$internalNotes', '$emailvia', '$createdOn', '1')");
$cid = $this->db->insert_id();
echo $cid;
$count = $this->input->post('contactCount');
for($i = 1; $i <= $count; $i++){
if($this->input->post('customerEmail1'.$i) != ''){
$customerEmail = $this->input->post('customerEmail1'.$i);
$customerPhone = $this->input->post('customerPhoneNumber'.$i);
$customerMobile = $this->input->post('customerMobileNumber'.$i);
$firstName = $this->input->post('firstName'.$i);
$lastName = $this->input->post('lastName'.$i);
$contAdd = mysqli_query("INSERT INTO `tbl_customer_contact` (customer_id, customer_contact_name, customer_contact_email, customer_contact_mobile, customer_contact_phone) VALUES('$cid', '$firstName"."$lastName', '$customerEmail', '$customerMobile', '$customerPhone')");
}
}
if($query){
//return 1;
}
}
I am getting this error while doing form post in codeigniter. I dont know where I am lagging.