Welcome Guest, Not a member yet? Register   Sign In
How to insert corporate details into database
#1

Firstly, I dont use a database very much but do find it necessary for storing members info & for logging in.

Now, I want to store corporate info & again for the corporate personnel to log in, just the same as we do in real life.

I have a Controller & view that creates folders for each corporation, and later intending the same for each country, and that works good. I just want to store the Corporates Name, Password, and Country into the database, and then be able to log in, just the same as a member logs in.

I have created a separate table, tbl_corporates, in the database with 5 columns (1) corporate_id (2) date_ registered (3) corporate_name (4) pass_word (5) country_territory

I guess the first 2 can be handled within the database.

I have created models for each country, the first being Afghanistancorporate_model. The coding within that model is as follows;

PHP Code:
<?php
defined
('BASEPATH') OR exit('No direct script access allowed');

class 
Afghanistancorporate_model extends CI_Model
{
    function 
__construct()
    {
    
parent::__construct();
    
$this->load->database();
    }

public function 
insert_corporate($corporatename$password$countryterritory)
    {
    
$data = array('corporate_name'=> $corporatename'pass_word'=> $password'country_territory'=> $countryterritory);
    
$this->db->insert('tbl_corporates'$data);
    }


Within the Controller I have the following;

PHP Code:
$this->load->model('Afghanistancorporate_model''afghanistancorporate_model');

$corporatename $this->input->post('corporatename');
$password $this->input->post('password');
$countryterritory $this->session->userdata('country_territory'); 

Ive tried putting the defined variables into the Model but that doesnt work. Ive also tried the $data = array in the Controller but that doesnt work.

I have searched many sites to find what Im doing wrong, but to no avail. Can anybody help?
Reply


Messages In This Thread
How to insert corporate details into database - by christaliise - 11-16-2020, 09:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB