Welcome Guest, Not a member yet? Register   Sign In
multiple inserts into the db
#4

[eluser]srajibtechno[/eluser]
my code is here...

<?php
class Client_signup extends Controller
{
function Client_signup()
{
parent::Controller();
$this->load->helper(array('form', 'url'));
$this->load->library(array('email', 'session'));
$this->load->model(array('check_model', 'insert_model', 'edit_model'));
}
function index()
{
$normal_acc = 0;
$business_acc = 0;
$data=array();
$data['title'] = ':: Client Signing - Step1 ::';

if($this->input->post('go'))
{
$account_type =$this->input->post('account_type') ;
$sql_data_set1= array(
'profile_id' => '',
'first_name' => trim($this->input->post('first_name')),
'middle_name' => trim($this->input->post('middle_name')),
'last_name' => trim($this->input->post('last_name')),
'business_name' => trim($this->input->post('business_name')),
'user_id' => trim($this->input->post('user_id')),
'user_password' => md5(trim($this->input->post('user_password'))),
'user_email' => trim($this->input->post('user_email')),
'user_photograph' => trim($this->input->post('user_photograph')),
'contact_number' => trim($this->input->post('contact_number')),
'birth_date' => trim($this->input->post('birth_date')),
'country' => trim($this->input->post('country')),
'state' => trim($this->input->post('state')),
'city' => trim($this->input->post('city')),
'zipcode' => trim($this->input->post('zipcode')),
'location' => trim($this->input->post('location')),
'user_ip' => getenv("REMOTE_ADDR"),
'security_question' => trim($this->input->post('security_question')),
'security_answer' => trim($this->input->post('security_answer')),
'registration_date' => date('Y-m-d'),
'other_info' => trim($this->input->post('other_info')) );

$sql_data_set2 = array(
'source_id' => '',
'company_name' => trim($this->input->post('company_name')),
'company_details' => trim($this->input->post('company_details')),
'company_business' => trim($this->input->post('company_business')),
'company_address' => trim($this->input->post('company_address')),
'company_contact_number' => trim($this->input->post('company_contact_number')),
'company_email' => trim($this->input->post('company_email'))
);

if( $this->insert_model->add_data('inbook_user_profile',$sql_data_set1)==true )
{
$normal_acc++;
if ($account_type == 'business')
{
if( $this->insert_model->add_data('inbook_user_profile',$sql_data_set2)==true )
{
$business_acc++;
}
}//end checking account type
}//end if

if( $normal_acc > 0 && $business_acc > 0 )
{
$data['conf_msg'] = 'Company Registration completed....';
$this->load->view('client_signup_process',$data);
}
else if( $normal_acc > 0 && $business_acc < 0 )
{
$data['conf_msg'] = 'Registration completed....';
$this->load->view('client_signup_process',$data);
}
else
{
$this->load->view('client_signup',$data);
}
}
}


Messages In This Thread
multiple inserts into the db - by El Forum - 05-13-2008, 11:18 AM
multiple inserts into the db - by El Forum - 05-13-2008, 11:44 AM
multiple inserts into the db - by El Forum - 07-19-2008, 11:59 PM
multiple inserts into the db - by El Forum - 07-20-2008, 12:00 AM



Theme © iAndrew 2016 - Forum software by © MyBB