same value is inserting into db after refresh of page in codeigniter
up vote
-2
down vote
favorite
This is My Controller.
public function place_order()
if($this->session->userdata('user') != '')
$files = $_FILES;
$filesCount = count($_FILES['userfile']['name']);
if (!empty($filesCount))
for($i=0; $i< $filesCount; $i++)
pdf
else
redirect('order-form');
$url = $this->input->post('email');
$amount = $this->input->post('amount');
$smchrge = 150;
$item = $this->input->post('items');
$order = count($item);
// $batch_id = $this->input->post('batc_id');
$auth_id = $this->session->userdata('user');
$batch_id = random_string('alnum', 20);
for ($i=0; $i < count($invoice); $i++)
$pkg_price = $amount[$i] + $smchrge ;
$row = parse_url($url[$i]);
if (empty($row['host'])) $parts = $row['path'];
else $parts = $row['host'];
$pre = 'SPME';
$tem_orid = date('dmYhis');
$id = random_string('numeric', 4);
$item_id = $pre.$tem_orid.$id;
$details = array(
'poy_website_url' =>$url[$i] ,
'parse_url' => $parts,
'poy_tot_amount'=>$amount[$i],
'poy_items'=>$item[$i],
'poy_invoice'=> $invoice[$i],
'poy_auth_id'=>$auth_id,
'poy_item_id'=>$item_id,
'poy_batch_item_id'=>$batch_id,
'poy_package_price'=>$pkg_price
);
$totalamount='';
$totalamount=$totalamount+$amount[$i];
$this->load->model('personal_shopper_model');
$this->personal_shopper_model->insertorder($details,$item_id,$auth_id );
$data['batch_id'] = $batch_id;
$data['pcount'] = $this->personal_shopper_model->paymentdetails($batch_id,$auth_id);
$data['itcount'] = $this->personal_shopper_model->itmdetails($batch_id,$auth_id);
else
redirect('login');
redirect('personal-shopper-shopping-cart-payment', 'refresh',$data);
I am tried to inserting the values into DB in codeigniter but same values are inserted after refreshing the page in CodeIgniter,i am inserting the array values by insert batch.i dont know where i am gone wrong please help me to correct this error I got stuck from last two days. any help would be appreciated.
this is my model
public function insertorder($details,$item_id,$auth_id)
$this->db->where('poy_auth_id', $auth_id);
$this->db->where('poy_item_id', $item_id);
$query = $this->db->get('place_order_yourself');
if ($query->num_rows() > 0)
$this->db->where('poy_item_id',$item_id);
$this->db->update_batch('place_order_yourself',$details, 'poy_item_id');
return true;
else
$this->db->insert_batch('place_order_yourself',$details);
return true;
codeigniter
New contributor
add a comment |
up vote
-2
down vote
favorite
This is My Controller.
public function place_order()
if($this->session->userdata('user') != '')
$files = $_FILES;
$filesCount = count($_FILES['userfile']['name']);
if (!empty($filesCount))
for($i=0; $i< $filesCount; $i++)
pdf
else
redirect('order-form');
$url = $this->input->post('email');
$amount = $this->input->post('amount');
$smchrge = 150;
$item = $this->input->post('items');
$order = count($item);
// $batch_id = $this->input->post('batc_id');
$auth_id = $this->session->userdata('user');
$batch_id = random_string('alnum', 20);
for ($i=0; $i < count($invoice); $i++)
$pkg_price = $amount[$i] + $smchrge ;
$row = parse_url($url[$i]);
if (empty($row['host'])) $parts = $row['path'];
else $parts = $row['host'];
$pre = 'SPME';
$tem_orid = date('dmYhis');
$id = random_string('numeric', 4);
$item_id = $pre.$tem_orid.$id;
$details = array(
'poy_website_url' =>$url[$i] ,
'parse_url' => $parts,
'poy_tot_amount'=>$amount[$i],
'poy_items'=>$item[$i],
'poy_invoice'=> $invoice[$i],
'poy_auth_id'=>$auth_id,
'poy_item_id'=>$item_id,
'poy_batch_item_id'=>$batch_id,
'poy_package_price'=>$pkg_price
);
$totalamount='';
$totalamount=$totalamount+$amount[$i];
$this->load->model('personal_shopper_model');
$this->personal_shopper_model->insertorder($details,$item_id,$auth_id );
$data['batch_id'] = $batch_id;
$data['pcount'] = $this->personal_shopper_model->paymentdetails($batch_id,$auth_id);
$data['itcount'] = $this->personal_shopper_model->itmdetails($batch_id,$auth_id);
else
redirect('login');
redirect('personal-shopper-shopping-cart-payment', 'refresh',$data);
I am tried to inserting the values into DB in codeigniter but same values are inserted after refreshing the page in CodeIgniter,i am inserting the array values by insert batch.i dont know where i am gone wrong please help me to correct this error I got stuck from last two days. any help would be appreciated.
this is my model
public function insertorder($details,$item_id,$auth_id)
$this->db->where('poy_auth_id', $auth_id);
$this->db->where('poy_item_id', $item_id);
$query = $this->db->get('place_order_yourself');
if ($query->num_rows() > 0)
$this->db->where('poy_item_id',$item_id);
$this->db->update_batch('place_order_yourself',$details, 'poy_item_id');
return true;
else
$this->db->insert_batch('place_order_yourself',$details);
return true;
codeigniter
New contributor
can you define what this means: "I am tried to inserting the values into DB in codeigniter but same values are inserted after refreshing the page in CodeIgniter" ... are you trying to say that the data gets inserted twice?
– Alex
23 hours ago
yup, the same data gets inserted repeatedly
– prathwi E K
22 hours ago
add a comment |
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
This is My Controller.
public function place_order()
if($this->session->userdata('user') != '')
$files = $_FILES;
$filesCount = count($_FILES['userfile']['name']);
if (!empty($filesCount))
for($i=0; $i< $filesCount; $i++)
pdf
else
redirect('order-form');
$url = $this->input->post('email');
$amount = $this->input->post('amount');
$smchrge = 150;
$item = $this->input->post('items');
$order = count($item);
// $batch_id = $this->input->post('batc_id');
$auth_id = $this->session->userdata('user');
$batch_id = random_string('alnum', 20);
for ($i=0; $i < count($invoice); $i++)
$pkg_price = $amount[$i] + $smchrge ;
$row = parse_url($url[$i]);
if (empty($row['host'])) $parts = $row['path'];
else $parts = $row['host'];
$pre = 'SPME';
$tem_orid = date('dmYhis');
$id = random_string('numeric', 4);
$item_id = $pre.$tem_orid.$id;
$details = array(
'poy_website_url' =>$url[$i] ,
'parse_url' => $parts,
'poy_tot_amount'=>$amount[$i],
'poy_items'=>$item[$i],
'poy_invoice'=> $invoice[$i],
'poy_auth_id'=>$auth_id,
'poy_item_id'=>$item_id,
'poy_batch_item_id'=>$batch_id,
'poy_package_price'=>$pkg_price
);
$totalamount='';
$totalamount=$totalamount+$amount[$i];
$this->load->model('personal_shopper_model');
$this->personal_shopper_model->insertorder($details,$item_id,$auth_id );
$data['batch_id'] = $batch_id;
$data['pcount'] = $this->personal_shopper_model->paymentdetails($batch_id,$auth_id);
$data['itcount'] = $this->personal_shopper_model->itmdetails($batch_id,$auth_id);
else
redirect('login');
redirect('personal-shopper-shopping-cart-payment', 'refresh',$data);
I am tried to inserting the values into DB in codeigniter but same values are inserted after refreshing the page in CodeIgniter,i am inserting the array values by insert batch.i dont know where i am gone wrong please help me to correct this error I got stuck from last two days. any help would be appreciated.
this is my model
public function insertorder($details,$item_id,$auth_id)
$this->db->where('poy_auth_id', $auth_id);
$this->db->where('poy_item_id', $item_id);
$query = $this->db->get('place_order_yourself');
if ($query->num_rows() > 0)
$this->db->where('poy_item_id',$item_id);
$this->db->update_batch('place_order_yourself',$details, 'poy_item_id');
return true;
else
$this->db->insert_batch('place_order_yourself',$details);
return true;
codeigniter
New contributor
This is My Controller.
public function place_order()
if($this->session->userdata('user') != '')
$files = $_FILES;
$filesCount = count($_FILES['userfile']['name']);
if (!empty($filesCount))
for($i=0; $i< $filesCount; $i++)
pdf
else
redirect('order-form');
$url = $this->input->post('email');
$amount = $this->input->post('amount');
$smchrge = 150;
$item = $this->input->post('items');
$order = count($item);
// $batch_id = $this->input->post('batc_id');
$auth_id = $this->session->userdata('user');
$batch_id = random_string('alnum', 20);
for ($i=0; $i < count($invoice); $i++)
$pkg_price = $amount[$i] + $smchrge ;
$row = parse_url($url[$i]);
if (empty($row['host'])) $parts = $row['path'];
else $parts = $row['host'];
$pre = 'SPME';
$tem_orid = date('dmYhis');
$id = random_string('numeric', 4);
$item_id = $pre.$tem_orid.$id;
$details = array(
'poy_website_url' =>$url[$i] ,
'parse_url' => $parts,
'poy_tot_amount'=>$amount[$i],
'poy_items'=>$item[$i],
'poy_invoice'=> $invoice[$i],
'poy_auth_id'=>$auth_id,
'poy_item_id'=>$item_id,
'poy_batch_item_id'=>$batch_id,
'poy_package_price'=>$pkg_price
);
$totalamount='';
$totalamount=$totalamount+$amount[$i];
$this->load->model('personal_shopper_model');
$this->personal_shopper_model->insertorder($details,$item_id,$auth_id );
$data['batch_id'] = $batch_id;
$data['pcount'] = $this->personal_shopper_model->paymentdetails($batch_id,$auth_id);
$data['itcount'] = $this->personal_shopper_model->itmdetails($batch_id,$auth_id);
else
redirect('login');
redirect('personal-shopper-shopping-cart-payment', 'refresh',$data);
I am tried to inserting the values into DB in codeigniter but same values are inserted after refreshing the page in CodeIgniter,i am inserting the array values by insert batch.i dont know where i am gone wrong please help me to correct this error I got stuck from last two days. any help would be appreciated.
this is my model
public function insertorder($details,$item_id,$auth_id)
$this->db->where('poy_auth_id', $auth_id);
$this->db->where('poy_item_id', $item_id);
$query = $this->db->get('place_order_yourself');
if ($query->num_rows() > 0)
$this->db->where('poy_item_id',$item_id);
$this->db->update_batch('place_order_yourself',$details, 'poy_item_id');
return true;
else
$this->db->insert_batch('place_order_yourself',$details);
return true;
codeigniter
codeigniter
New contributor
New contributor
New contributor
asked 23 hours ago
prathwi E K
1
1
New contributor
New contributor
can you define what this means: "I am tried to inserting the values into DB in codeigniter but same values are inserted after refreshing the page in CodeIgniter" ... are you trying to say that the data gets inserted twice?
– Alex
23 hours ago
yup, the same data gets inserted repeatedly
– prathwi E K
22 hours ago
add a comment |
can you define what this means: "I am tried to inserting the values into DB in codeigniter but same values are inserted after refreshing the page in CodeIgniter" ... are you trying to say that the data gets inserted twice?
– Alex
23 hours ago
yup, the same data gets inserted repeatedly
– prathwi E K
22 hours ago
can you define what this means: "I am tried to inserting the values into DB in codeigniter but same values are inserted after refreshing the page in CodeIgniter" ... are you trying to say that the data gets inserted twice?
– Alex
23 hours ago
can you define what this means: "I am tried to inserting the values into DB in codeigniter but same values are inserted after refreshing the page in CodeIgniter" ... are you trying to say that the data gets inserted twice?
– Alex
23 hours ago
yup, the same data gets inserted repeatedly
– prathwi E K
22 hours ago
yup, the same data gets inserted repeatedly
– prathwi E K
22 hours ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
prathwi E K is a new contributor. Be nice, and check out our Code of Conduct.
prathwi E K is a new contributor. Be nice, and check out our Code of Conduct.
prathwi E K is a new contributor. Be nice, and check out our Code of Conduct.
prathwi E K is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53222216%2fsame-value-is-inserting-into-db-after-refresh-of-page-in-codeigniter%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
can you define what this means: "I am tried to inserting the values into DB in codeigniter but same values are inserted after refreshing the page in CodeIgniter" ... are you trying to say that the data gets inserted twice?
– Alex
23 hours ago
yup, the same data gets inserted repeatedly
– prathwi E K
22 hours ago