Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 8,171
» Latest member: aldo.shb
» Forum threads: 65,672
» Forum posts: 412,988

Full Statistics

Latest Threads
Error 404 in log
Forum: Issues
36 minutes ago
» Replies: 3   » Views: 111
CodeIgniter 4 Important F...
Forum: CodeIgniter 4 Development
1 hour ago
» Replies: 21   » Views: 18,164
Ajax output problem
Forum: General Help
2 hours ago
» Replies: 3   » Views: 113
BCIT newsletter story abo...
Forum: News & Discussion
9 hours ago
» Replies: 7   » Views: 2,410
undefined variable
Forum: General Help
Yesterday, 02:06 PM
» Replies: 7   » Views: 128
CodeIgniter 3.1.4 release...
Forum: News & Discussion
Yesterday, 04:11 AM
» Replies: 15   » Views: 4,767
when released?
Forum: CodeIgniter 4 Discussion
Yesterday, 01:52 AM
» Replies: 1   » Views: 103
problem with $posts varia...
Forum: Model-View-Controller
Yesterday, 01:08 AM
» Replies: 5   » Views: 83
affect vs effect
Forum: Lounge
03-25-2017, 08:55 AM
» Replies: 6   » Views: 216
Ajax Question
Forum: General Help
03-25-2017, 04:04 AM
» Replies: 3   » Views: 153

 
Sad Ajax output problem
Posted by: falcon812311 - Yesterday, 06:09 AM - Forum: General Help - Replies (3)

Hi,
I'm newbie in ajax, my problem is my ajax just can open 1st row only and 2nd row i receive null no data retrieve from ajax

this is my AJAX problem.

 

Code:
<!-- ajax req -->
    <script type="application/javascript">
            $('.dropdown-menu').on('click', '.payment_proof-show ', function(){
                var user_id = $(this).attr('data');
                //$('#modal_paymentProof').attr('id', "modal_paymentProof"+user_id);
                $.ajax({
                    type: 'ajax',
                    method: 'get',
                    url: '<?php echo base_url() ?>download/payment_proof_detail',
                    data: {user_id: user_id},
                    async: false,
                    dataType: 'json',
                    success: function(data) {
                        var html= '';
                        var i;
                        for(i=1; i<data.length; i++){
                            html+='<tr>'+
                                '<td>'+i+ user_id +'</td>'+
                                '<td>'+data[i].remarks+'</td>'+
                                '<td>'+data[i].user_id+'</td>'+
                                '<td><a href="<?php echo base_url() ?>Admin/payment_proof_download/'+data[i].payment_proof+'" class="btn btn-info"> <i class="fa fa-download fa-size-medium"></i> Download</a></td>'+
                             '</tr>';

                        }

                        $('#payment-proof').html(html);
                    },
                    error: function() {
                        alert('Something going wrong');
                    }
                });
            });
    </script>

this is my view

PHP Code:
<body>
 
 <!--<div class="container"> -->
 
   <div class="col-md-12">
 
     <div class="well">

 
       <fieldset>
 
         <h4>User List</h4>
 
         <hr>
 
         <div class="form-group">
 
             <?php
              echo form_open
('Admin/search_user');
 
               ?>
              <div class="col-md-5 input-group">
                <span class="input-group-addon"><i class="fa  fa-search fa-size-medium"></i></span>
                <input type="text" name="search_user" class="form-control">
                <span class="input-group-btn">
                  <button class="btn btn-default" type="submit">Search</button>
                </span>

              </div>
              <p class="help-block">User ID, Full Name, State, Phone Number, and IC No.</p>
            </form>

          </div>
          <div class="table-responsive">
            <table class="table table-striped table-hover">
              <th>Username/ID</th>
              <th>Active Date</th>
              <th>Full Name</th>
              <th>Mobile No.</th>

              <th>State</th>
              <th>Member Type</th>
              <th>Set(S)</th>
              <th>Correspondent Name</th>
              <th>Create User</th>
              <th>Create Date</th>
              <th colspan="2">Action</th>
              <?php

              foreach 
($get_list as $list) {
 
               echo '
                <tr>
                    <td>'
.$list['username'].'</td>
                    <td>'
.date'd/m/Y'strtotime($list['active_date'])).'</td>
                    <td>'
.$list['name'].'</td>
                    <td>'
.$list['mobile_number'].'</td>
                    <td>'
.$list['state'].'</td>
                    <td>'
;
 
                     if ($list['auth_level'] == 1)
 
                     {
 
                         echo '<span class="label label-default">Member</span>';
 
                     }
 
                     elseif ($list['auth_level'] == 2)
 
                     {
 
                         echo '<span class="label label-primary">Stokis</span>';
 
                     }
 
                     elseif ($list['auth_level'] == 3)
 
                     {
 
                       echo '<span class="label label-primary">Vendor</span>';
 
                     }

 
                   echo '</td>
                    <td>'
.$list['total_set'].'</td>
                    <td>'
.$list['name_crrespondent'].'</td>
                    <td>'
.$list['correspondent_id_no'].'</td>
                    <td>'
.date'd/m/Y'strtotime($list['register_date'])).'</td>
                    <td>
                    <div class="btn-group pull-right">
                      <a href="#" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                        Select Action
                        <span class="caret"></span>
                      </a>
                      <ul class="dropdown-menu">
                        <li><a href="'
.base_url('Admin/basic_info/'.$list['user_id']).'"><i class="fa fa-user-circle-o"></i> Basic Info</a></li>
                        <li><a href="'
.base_url('Admin/userview/'.$list['user_id']).'"><i class="fa fa-pencil"></i> View / Edit</a></li>
                        <li><a href="'
.base_url('Admin_Auth/login_detail/'.$list['user_id']).'"><i class="fa fa-vcard"></i> Login Detail</a></li>
                        <li><a class="payment_proof-show" data-target="#modal_paymentProof'
.$list['user_id'].'"  data-toggle="modal" data="'.$list['user_id'].'"><i class="fa  fa-usd"></i> Payment Proof</a></li>
                        <li><a href="'
.base_url('Admin_Auth/resetUserPassword/'.$list['user_id']).'"><i class="fa  fa-unlock-alt"></i> Reset Password</a></li>
                        <li><a href="#"><i class="fa fa-remove"></i> Delete</a></li>
                       </ul>
                    </div>
                    </td>
                    <td>
                        <a href="'
.base_url('Admin/add_set/'.$list['user_id']).'" class="btn btn-info">
                        <i class="fa fa-plus fa-size-medium"></i> Add Set</a>
                   </td>
                  </tr>'
;
 
             }


 
             ?>
            </table>
          </div><!-- table responsive -->
        </fieldset>
      </div>
    </div>
    <?php

      foreach 
($get_list as $list) {
 
       echo '<div  class="modal fade" id="modal_paymentProof'.$list['user_id'].'">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">Payment Prooft</h4>
              </div>
              <div class="modal-body">
              <p>
              <div class="form-horizontal">
              <div class="form-group">
                <label for="username" class="control-label col-sm-2">Username</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control uppercase" id="username" name="username" value="'
.$list['username'].'" disabled="">
                  </div>
                </div>
                <div class="form-group">
                  <label for="name" class="control-label col-sm-2">Name</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control uppercase" id="name" name="name" value="'
.$list['name'].'" disabled="">
                  </div>
                  </div>
              </div>
              <h5>File List</h5>
              <hr>
              <table class="table">
              <thead>
                  <th>No.</th>
                  <th>Remarks</th>
                  <th>Action</th>
                </thead>
                <tbody id="payment-proof">

                </tbody>
              </table>
              </p>
              </div><!-- /modal-body -->
              <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
              </div>
            </div>
          </div>
        </div>'
;
 
     }

 
   ?>

  <!-- </div> end container --> 

this is my controller
PHP Code:
public function payment_proof_detail()
    {
        
$user_id $this->input->get('user_id');
        
$result $this->Auth_Model->get_payment_proof($user_id);
        echo 
json_encode($result);

    } 

this is my modal
PHP Code:
function get_payment_proof($id)
 
 {
 
   $data = array();
 
   $this->db->select('*');
 
   $this->db->from('payment_proof');
 
   $this->db->where('user_id'$id);
 
   $query $this->db->get();

 
   if ($query->num_rows() > 0)
 
   {
 
       foreach ($query->result_array() as $row)
 
       {
 
           $data[] = $row;
 
       }
 
   }
 
   $query->free_result();
 
   return $data;

 
 

Help me. i can't sleep bcoz this.


  when released?
Posted by: RAMP - Yesterday, 01:19 AM - Forum: CodeIgniter 4 Discussion - Replies (1)

First: Sorry for my English. Angel
Second: When can we see the finished version of this product? I'm looking at CI4 from the date of the announcement and is still empty. Yes, I saw Pre-alpha (which is not recommended to use) how much will this status be? year? two? Then what? Alpha ... Pre-beta ... Beta ... Pre-gamma ... Gamma ...
I liked CI3, but as it was already said, it is really outdated and requires modernization. I understand the problems of developers that they can not do everything at once. But more than a year has passed.
I want to know the timing of the final product. And decide whether to wait for it at all.


  problem with $posts variable
Posted by: anmol - Yesterday, 12:05 AM - Forum: Model-View-Controller - Replies (5)

i am a beginner in codeigniter,i am trying to make a crud website for learning website but i am facing this error.
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: posts
Filename: posts/index.php
Line Number: 2
Backtrace:
File: /opt/lampp/htdocs/codeigniter/application/views/posts/index.php
Line: 2
Function: _error_handler
File: /opt/lampp/htdocs/codeigniter/application/controllers/Posts.php
Line: 23
Function: view
File: /opt/lampp/htdocs/codeigniter/index.php
Line: 315
Function: require_once

my controller file is

<?php
class Posts extends CI_Controller{
    public function index(){
        $data['title']='Latest Posts';
        $data['posts']=$this->Post_model->get_posts();




        $this->load->view('templates/header');
        $this->load->view('posts/index',$data);
        $this->load->view('templates/footer');
    }
    public function view($slug=NULL)
    {
        $data['post']=$this->Post_model->get_posts($slug);
        if(empty($data['post'])){
            show_404();
        }
        $data['title']=$data['post']['title'];
        print_r('$data');




        $this->load->view('templates/header');
        $this->load->view('posts/view',$data);
        $this->load->view('templates/footer');
    }

    public function create(){
        $data['title']='create post';
        $this->form_validation->set_rules('title','Title','required');
        $this->form_validation->set_rules('body','body','required');
        if($this->form_validation->run()===false){$this->load->view('templates/header');

        $this->load->view('posts/create',$data);
        $this->load->view('templates/footer');


        }
        else{
            $this->Post_model->create_post();
            printr('$data');

redirect('posts');
}

        
        }
        public function delete($id)
        {
            $this->Post_model->delete_post($id);
            redirect('posts');
        }



        
    public function edit($id)
    {

        $data['post']=$this->Post_model->get_posts($slug);
        if(empty($data['post'])){
            show_404();
        }
        $data['title']='edit post';
        $this->load->view('templates/header');
        $this->load->view('posts/index',$data);
        $this->load->view('templates/footer');
    }

    public function update()
    {
         $this->Post_model->update_post();
         redirect('posts');
}
}




my model file is
<?php
class Post_model extends CI_Model{
    public function __construct(){
$this->load->database();

    }
public function get_posts($slug=false){
if($slug===false){
    $this->db->order_by('id','DESC');

    $query=$this->db->get('posts');
    return $query->result_array();

}
$query=$this->db->get_where('posts',array('slug'=>$slug));
    return $query->row_array();
}
public function create_post(){
    $slug=url_title($this->input->post('title'));
    $data=array('title'=>$this->input->post('title'),
        'slug'=>$slug,
        'body'=>$this->input->post('body')
        );
    return $this->db->insert('posts',$data);
    
}

public function delete_post($id){

    $this->db->where('id',$id);
    $this->db->delete('posts');
    return true;
}

public function update_post()
{
    $slug=url_title($this->input->post('title'));
    $data=array('title'=>$this->input->post('title'),
        'slug'=>$slug,
        'body'=>$this->input->post('body')
        );    $this->db->where('id',$this->input->post('id'));
    return $this->db->update('posts',$data);

    

}


}
my index view is


<h2><?=$title?></h2>
<?php foreach($posts as $post)?>
    <h3><?php echo $post['title'];?></h3>o
    <small class="post-date">Posted on:<?php echo $post['created at'];?></small><br>
    <?php echo word_limiter($post['body'],60);?>
    <p><a class="btn btn-default" href="<?php echo site_url('/posts/' .$post['slug']);?>">read more</a></p>
    
<?php endforeach;?>

i am autoloaing my database in config.
plz someone help me out i am stuck.


  undefined variable
Posted by: anmol - 03-25-2017, 01:39 PM - Forum: General Help - Replies (7)

i am actually make a basic crud website,i am a beginner in codeigniter.i am following a youtube channel.and copying his exact code and still facing a problem.
my model is

Code:
<?php
class Post_model extends CI_Model{
    public function __construct(){
$this->load->database();

    }
public function get_posts($slug=false){
if($slug===false){
    $this->db->order_by('id','DESC');

    $query=$this->db->get('posts');
    return $query->result_array();

}
$query=$this->db->get_where('posts',array('slug'=>$slug));
    return $query->row_array();
}
public function create_post(){
    $slug=url_title($this->input->post('title'));
    $data=array('title'=>$this->input->post('title'),
        'slug'=>$slug,
        'body'=>$this->input->post('body')
        );
    return $this->db->insert('posts',$data);
}

public function delete_post($id){

    $this->db->where('id',$id);
    $this->db->delete('posts');
    return true;
}

public function update_post()
{
    $slug=url_title($this->input->post('title'));
    $data=array('title'=>$this->input->post('title'),
        'slug'=>$slug,
        'body'=>$this->input->post('body')
        );    $this->db->where('id',$this->input->post('id'));
    return $this->db->update('posts',$data);

    

}


}
my controller is

<?php
class Posts extends CI_Controller{
    public function index(){
        $data['title']='Latest Posts';
        $data['posts']=$this->Post_model->get_posts();




        $this->load->view('templates/header');
        $this->load->view('posts/index',$data);
        $this->load->view('templates/footer');
    }
    public function view($slug=NULL)
    {
        $data['post']=$this->Post_model->get_posts($slug);
        if(empty($data['post'])){
            show_404();
        }
        $data['title']=$data['post']['title'];
        $this->load->view('templates/header');
        $this->load->view('posts/index',$data);
        $this->load->view('templates/footer');
    }

    public function create(){
        $data['title']='create post';
        $this->form_validation->set_rules('title','Title','required');
        $this->form_validation->set_rules('body','body','required');
        if($this->form_validation->run()===false){$this->load->view('templates/header');
        $this->load->view('posts/create',$data);
        $this->load->view('templates/footer');


        }
        else{
            $this->Post_model->create_post();

redirect('posts');
}

        
        }
        public function delete($id)
        {
            $this->Post_model->delete_post($id);
            redirect('posts');
        }



        
    public function edit($id)
    {

        $data['post']=$this->Post_model->get_posts($slug);
        if(empty($data['post'])){
            show_404();
        }
        $data['title']='edit post';
        $this->load->view('templates/header');
        $this->load->view('posts/index',$data);
        $this->load->view('templates/footer');
    }

    public function update()
    {
         $this->Post_model->update_post();
         redirect('posts');
}
}
my view for showing blog post is
<h2><?=$title?></h2>
<?php foreach($posts as $post):?>
    <h3><?php echo $post['title'];?></h3>o
    <small class="post-date">Posted on:<?php echo $post['created at'];?></small><br>
    <?php echo word_limiter($post['body'],60);?>
    <p><a class="btn btn-default" href="<?php echo site_url('/posts/' .$post['slug']);?>">read more</a></p>
    
<?php endforeach;?>

error it shows when i click on read more is '$posts variable is not defined' without $posts i can't loop through the blog posts of database.plz help me out how to solve this problem.if you won't to have a look at my other files i will be glad to show.

Message: Undefined variable: posts
Filename: posts/index.php
Line Number: 2
Backtrace:
File: /opt/lampp/htdocs/codeigniter/application/views/posts/index.php
Line: 2
Function: _error_handler
File: /opt/lampp/htdocs/codeigniter/application/controllers/Posts.php
Line: 23
Function: view
File: /opt/lampp/htdocs/codeigniter/index.php
Line: 315
Function: require_once


  Ajax Question
Posted by: wolfgang1983 - 03-25-2017, 03:08 AM - Forum: General Help - Replies (3)

When I keyup on my input it runs the ajax

But on success it creates a class called well multiple times as shown in image below

[Image: 3GlIXGdE7aUN.png]



How can I make sure it only creates one class only even when keyup.

Code:
$('input[name=\'tags\']').on('keyup', function(e){
    $.ajax({
        url: "<?php echo base_url('questions/tags');?>",
        dataType: 'json',
        type: 'post',
        data: {
            tags: $('input[name=\'tags\']').val()
        },
        success: function(json) {
            $('<p class="well"></p>').insertAfter($("input[name='tags']"));
        }
    });

});


Wink codeigniter snippets for atom editor
Posted by: sagar313 - 03-24-2017, 01:42 PM - Forum: Addins - No Replies

Increase  your codeing speed on atom editor using codeigniter3-snippets package
visit the link and download codeigniter3-snippets.
https://atom.io/packages/codeigniter3-snippets

[Image: code.gif]


  Community Auth Database Engine
Posted by: Schop - 03-24-2017, 08:54 AM - Forum: Addins - Replies (1)

I'm considering using Community Auth for a new project. As I'm browsing through the source, I noticed that some database tables use MyISAM as the engine, and others use InnoDB. Is this on purpose? Why wouldn't it be the same?


  How to create Admin Section in CodeIgniter Project?
Posted by: Shivafeb17 - 03-23-2017, 11:21 PM - Forum: Best Practices - Replies (2)

Hi all, 

I have created a simple project in CI. Now I want to create users and Admins. How to create an area only admin can login and modify data? Should I create an ADMIN Folder in APPLICATION folder and install another CI in it?


  Does CodeIgniter SMTP client actually use TSL to send email?
Posted by: sneakyimp - 03-23-2017, 07:11 PM - Forum: Libraries & Helpers - Replies (1)

I configured my email settings to connect to sendgrid on port 587 and use tsl:

Code:
$config["useragent"] = "CodeIgniter";
$config["protocol"] = "smtp"; // or mail or sendmail
$config["mailpath"] = "/usr/sbin/sendmail";
$config["smtp_host"] = "smtp.sendgrid.net";
$config["smtp_user"] = "apikey";
$config["smtp_pass"] = "<SENDGRID-API-KEY-HERE>";
$config["smtp_port"] = 587;
$config["smtp_crypto"] = "tsl";
$config["dsn"] = FALSE;
// ETC
I wrote a short script on a controller:
Code:
    public function mailtest()
    {
        
        $this->load->library('email');
        
        $this->email->from([email protected]', $this->config->item("site_name"));
        $this->email->to([email protected]');
        
        $this->email->subject('Email Test ' . microtime(TRUE));
        $this->email->message('Testing email config with new port');
        
        $this->email->send(FALSE);
        header("content-type: text");
        echo ($this->email->print_debugger());
        die("done");
    }

When I look at the output of print_debugger(), I don't see any STARTTLS command:
Code:
220 SG ESMTP service ready at ismtpd0003p1sjc2.sendgrid.net
<br /><pre>hello: 250-smtp.sendgrid.net
250-8BITMIME
250-PIPELINING
250-SIZE 31457280
250-STARTTLS
250-AUTH PLAIN LOGIN
250 AUTH=PLAIN LOGIN
</pre><pre>from: 250 Sender address accepted
</pre><pre>to: 250 Recipient address accepted
</pre><pre>data: 354 Continue
</pre>250 Ok: queued as tegwA0rzQKWW-zhM2QCUYg
<br /><pre>quit: 221 See you later
</pre>Your message has been successfully sent using the following protocol: smtp<br /><pre>Date: Thu, 23 Mar 2017 17:57:40 -0700
From: &quot;sneakyimp workstation&quot; &lt;[email protected]&gt;
Return-Path: &lt;[email protected]&gt;
To: [email protected]
Subject: =?UTF-8?Q?Email=20Test=20149031706?==?UTF-8?Q?0.8739?=
Reply-To: &lt;[email protected]&gt;
User-Agent: CodeIgniter
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: &lt;[email protected]&gt;
Mime-Version: 1.0


Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Testing email config with new port
</pre>
Is the server output truncated or something? How can I be sure that my server's interactions with the SMTP gateway are encrypted?


  affect vs effect
Posted by: skunkbad - 03-23-2017, 02:53 PM - Forum: Lounge - Replies (6)

I consider myself a real idiot when it comes to the English language, and perhaps a lot of other things. Every time I see the DB function affected_rows, it makes me wonder if it should be effected_rows. So I checked it out on Google, and talked to somebody else about it, and it didn't help.

If affect is supposed to be a verb, and effect a noun, but "affected rows" makes it an adjective, right? Nowhere in the dictionary that I'm looking at does it say that affected or effected would be right.



  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.