Guest User

Untitled

a guest
Oct 23rd, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.79 KB | None | 0 0
  1. public function update(){ //Editing blogger data from blogger/view.php in tbl_bloggers
  2. $id = $this->input->post('txt_hidden');
  3.  
  4. $field = array(
  5. 'blogger_name'=>$this->input->post('blogger_name'),
  6. 'email'=>$this->input->post('email'),
  7. 'phone'=>$this->input->post('phone'),
  8. 'fb_page'=>$this->input->post('fb_page'),
  9. 'fb_group'=>$this->input->post('fb_group'),
  10. 'instagram'=>$this->input->post('instagram'),
  11. 'twitter'=>$this->input->post('twitter'),
  12. 'snapchat'=>$this->input->post('snapchat'),
  13. 'youtube'=>$this->input->post('youtube'),
  14. 'web'=>$this->input->post('web'),
  15. 'bank'=>$this->input->post('bank'),
  16. 'b_acc_title'=>$this->input->post('b_acc_title'),
  17. 'b_branch'=>$this->input->post('b_branch'),
  18. 'b_account'=>$this->input->post('b_account')
  19. );
  20.  
  21.  
  22.  
  23. foreach($this->input->post('cat') as $cat) {
  24. // $query=$this->db->query("INSERT INTO tbl_bloggers_cat (blogger_id, Cat_id) VALUES('$id',$cat)");
  25. $query=$this->db->query("UPDATE tbl_bloggers_cat SET Cat_id = $cat WHERE blogger_id = $id");
  26. }
  27.  
  28. $this->db->where('blogger_id', $id);
  29. $this->db->update('tbl_bloggers', $field);
  30. echo $this->db->last_query();extit;
  31. if($this->db->affected_rows() > 0){
  32. return true;
  33. }else{
  34. return false;
  35. }
  36. }
  37.  
  38. <?php
  39. $blog = $bloggers->blogger_id;
  40.  
  41. foreach ($list as $bcat) { // get data from main categ
  42. //if($blog == $ccat->blogger_id){
  43. $a = $bcat->cat_id; //
  44. foreach($list2 as $ccat){ // getting cat id from junction table
  45. if($blog == $ccat->blogger_id && $a == $ccat->Cat_id){
  46. ?>
  47. <label><input type="checkbox" id="cat" name="cat[]" value="<?php echo $bcat->cat_id; ?>" checked<?php echo set_checkbox('accept_terms_checkbox', '$bcat->cat_id'); ?>><?php echo ucfirst($bcat->category); ?></label>
  48. <?php }
  49. else{
  50. ?>
  51.  
  52. <?php
  53. }
  54. }
  55. }
  56.  
  57. public function update(){
  58. $result = $this->bm->update();
  59. if($result){
  60. $this->session->set_flashdata('success_msg', 'Record updated successfully');
  61. }else{
  62. $this->session->set_flashdata('error_msg', 'Faill to update record');
  63. }
  64. redirect(base_url('blogger/index'));
  65. }
Add Comment
Please, Sign In to add comment