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;











share|improve this question







New contributor




prathwi E K is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • 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














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;











share|improve this question







New contributor




prathwi E K is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • 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












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;











share|improve this question







New contributor




prathwi E K is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











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






share|improve this question







New contributor




prathwi E K is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




prathwi E K is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




prathwi E K is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 23 hours ago









prathwi E K

1




1




New contributor




prathwi E K is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





prathwi E K is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






prathwi E K is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











  • 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










  • 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

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






prathwi E K is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















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



































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.









 

draft saved


draft discarded


















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.













 


draft saved


draft discarded














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














































































這個網誌中的熱門文章

How to combine Bézier curves to a surface?

Carbon dioxide

Why am i infinitely getting the same tweet with the Twitter Search API?