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

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 8,438
» Latest member: EnergyFreak
» Forum threads: 65,875
» Forum posts: 413,866

Full Statistics

Latest Threads
Are there any CodeIgniter...
Forum: Jobs
2 hours ago
» Replies: 2   » Views: 77
CSV Importing Advice
Forum: General Help
4 hours ago
» Replies: 4   » Views: 103
How to format template?
Forum: Model-View-Controller
6 hours ago
» Replies: 6   » Views: 282
MongoCollection::update()...
Forum: General Help
7 hours ago
» Replies: 0   » Views: 31
XML error: Invalid docume...
Forum: CodeIgniter 2.x
9 hours ago
» Replies: 1   » Views: 40
How to Get Banned
Forum: News & Discussion
10 hours ago
» Replies: 12   » Views: 7,314
Create custom link url fo...
Forum: General Help
10 hours ago
» Replies: 5   » Views: 192
priority of validation
Forum: Libraries & Helpers
Today, 08:18 AM
» Replies: 4   » Views: 163
Ecommerce website in CI
Forum: Choosing CodeIgniter
Today, 07:32 AM
» Replies: 6   » Views: 447
insert_batch() not workin...
Forum: CodeIgniter 3.x
Today, 07:12 AM
» Replies: 8   » Views: 350

 
  Are there any CodeIgniter developers for hire?
Posted by: EnergyFreak - 6 hours ago - Forum: Jobs - Replies (2)

Hi everyone,

I am looking for a CodeIgniter developer to work on a CRM type project, preferably in Canada, Quebec. I need someone with existing CRM experience, PHP, JS and SQL (for db).

It would be to customize a current CRM application built with CI framework, including removing and extending existing modules and also to create some custom modules such as internal email client, commission structure, etc.

I could give more information in a PM.

Thank you!


  MongoCollection::update() Warning
Posted by: balasourav - 7 hours ago - Forum: General Help - No Replies

Am Using Codeigniter with mongodb. I got this Following Erro when i update my code. 

A PHP Error was encountered
Severity: Warning
Message: MongoCollection::update(): The value of the 'w' option either needs to be a integer or string
Filename: libraries/Mongo_db.php
Line Number: 1241
Backtrace:
File: /localhost/mongo/application/libraries/Mongo_db.php
Line: 1241
Function: update

File: /localhost/mongo/application/models/Login_model.php
Line: 80
Function: update

File: /localhost/mongo/application/controllers/Login_Controller.php
Line: 91
Function: updateUserDetails

File: /localhost/mongo/index.php
Line: 315
Function: require_once



What can i do for this type of warning. And This Error Only Occur in live server.

My update Coding is - 
$userId    = '58ff651dd98a860c15000029';
$data = array('PROFILE_PHOTO'=>$picName);
$this->mongo_db->where('_id', new MongoId($userId))->set($data)->update('user_details');


  CSV Importing Advice
Posted by: keithmclaughlin - 11 hours ago - Forum: General Help - Replies (4)

Hi,

I'm looking for advice on the best way to import a CSV file.

The file has the following fields:

Code:
FirstName, LastName, EmailAddress, Department, Role

Everything is working except that it is slow. I haven't tested it with more than 10 users in the CSV file. I expect that there will be times where a CSV file will contain thousands of users.

I would also like to provide better feedback as the import progresses for things like an email address already existing in the database (I'd love if it was like the WordPress importer that shows a message per user imported).

Here is my import function:

PHP Code:
public function import()
{
 
   $this->load->helper('form');

 
   if ( ! empty($_FILES) )
 
   {
 
       $config['upload_path'] = $this->company_lib->get_uploads_folder($this->user->company_id);
 
       $config['allowed_types'] = 'csv';
 
       $config['max_size'] = $this->config->item('max_file_size');
 
       $this->load->library('upload'$config);

 
       if ( ! $this->upload->do_upload('file') )
 
       {
 
           $this->flasher->set_danger($this->upload->display_errors(''''), 'setup/import'TRUE);
 
       }
 
       else
        
{
 
           $data $this->upload->data();

 
           $this->load->library('csvreader');
 
           $this->load->helper('string');

 
           if ($data['file_ext'] == '.csv'// will eventually provide excel file uploads too
 
           {
 
               $fields $this->csvreader->parse_file($data['full_path']);

 
               if ( ! empty($fields) )
 
               {
 
                   foreach ($fields as $field)
 
                   {
 
                       $email $field['EmailAddress'];
 
                       $first_name $field['FirstName'];
 
                       $last_name $field['LastName'];
 
                       $department_name $field['Department'];
 
                       $role $field['Role'] + 2// add 2 because csv contains 1 for department manager & 2 for employee (for simplicity)

 
                       // make sure they cannot add a user with a role of 1 (admin) or 2 (manager)
 
                       if ($role >= 3)
 
                       {
 
                           if ( ! $this->ion_auth->email_check($email) )
 
                           {
 
                               $salt $this->config->item('store_salt''ion_auth') ? $this->ion_auth->salt() : FALSE;
 
                               $password random_string('alnum'12);
 
                               $hashed_password $this->ion_auth->hash_password($password$salt);

 
                               // User must be created first, in order to have the id
 
                               $user_data = [
 
                                   'company_id' => $this->user->company_id,
 
                                   'password' => $hashed_password,
 
                                   'email' => $email,
 
                                   'active' => 1,
 
                                   'is_dep_manager' => $role == NULL
                                
];

 
                               $user_id $this->user_model->insert($user_data); // insert new user into users table

 
                               unset($user_data);

 
                               $this->ion_auth_model->add_to_group($role$user_id); // add user to users_groups table

 
                               // send welcome email to user
 
                               $email_data = ['email' => $email'password' => $password];
 
                               $this->email_lib->send_email($emaillang('setup_welcome_email_subject'), 'setup/emails/welcome'$email_data);

 
                               // once user is inserted, create their profile
 
                               $profile_data = [
 
                                   'user_id'           => $user_id,
 
                                   'first_name'        => $first_name,
 
                                   'last_name'         => $last_name,
 
                               ];
 
                               $this->profile_model->insert($profile_data);

 
                               $this->load->model('department_model');

 
                               // check if department for the company exists in the database
 
                               $department $this->department_model
                                                   
->fields('id')
 
                                                  ->where(['name' => $department_name'company_id' => $this->user->company_id])
 
                                                  ->get();

 
                               // if department does NOT exist, create one
 
                               if ( ! $department )
 
                               {
 
                                   $department_data = [];

 
                                   $department_data['name'] = $department_name;
 
                                   $department_data['company_id'] = $this->user->company_id;

 
                                   if ($role == 3// User is a department manager, so set them as the assigned user for the department
 
                                   {
 
                                       $department_data['assigned_user_id'] = $user_id;
 
                                   }

 
                                   $department_id $this->department_model->insert($department_data);

 
                                   // update the user with the new department id
 
                                   $this->user_model->update(['department_id' => $department_id], $user_id);
 
                               }
 
                               else
                                
{
 
                                   // a department already exists, so set the users department_id to the existing department
 
                                   $this->user_model->update(['department_id' => $department['id']], $user_id);
 
                               }

 
                               $this->flasher->set_success(lang('setup_import_successful'), NULLTRUE);
 
                           }
 
                           else
                            
{
 
                               $this->flasher->set_danger(sprintf(lang('setup_import_failed_email'), $email), NULLTRUE);
 
                           }
 
                       }
 
                       else
                        
{
 
                           $this->flasher->set_danger(lang('setup_import_failed_role'), NULLTRUE);
 
                       }
 
                   
 
               }
 
               else
                
{
 
                   $this->flasher->set_danger(lang('setup_import_failed_file_is_empty'), 'setup/import'TRUE);
 
               }

 
               unlink($data['full_path']); // delete the uploaded csv file

 
               $this->update_setup_step(6);

 
               redirect('setup/finish');
 
           }
 
       }
 
   }
 
   else
    
{
 
       $this->template->title(lang('setup_import_heading'))
 
                            ->set_js('bootstrap-filestyle.min')
 
                            ->build('setup/import'$this->data);
 
   }


Here is the CSVReader class:

PHP Code:
class CSVReader {

 
   var $fields/** columns names retrieved after parsing */ 
 
   var $separator ';'/** separator used to explode each line */
 
   var $enclosure '"'/** enclosure used to decorate each field */

 
   var $max_row_size 4096/** maximum row size to be used for decoding */

 
   function parse_file($p_Filepath)
 
   {
 
       $file           fopen($p_Filepath'r');
 
       $this->fields   fgetcsv($file$this->max_row_size$this->separator$this->enclosure);
 
       $keys_values    explode(','$this->fields[0]);

 
       $content    = array();
 
       $keys       $this->escape_string($keys_values);

 
       $i 1;
 
       while( ($row fgetcsv($file$this->max_row_size$this->separator$this->enclosure)) != false )
 
       {
 
           if $row != null // skip empty lines
 
           {
 
               $values explode(','$row[0]);
 
               if (count($keys) == count($values))
 
               {
 
                   $arr        = array();
 
                   $new_values = array();
 
                   $new_values $this->escape_string($values);
 
                   for ($j 0$j count($keys); $j++)
 
                   {
 
                       if ($keys[$j] != "")
 
                       {
 
                           $arr[$keys[$j]] = $new_values[$j];
 
                       }
 
                   }
 
                   $content[$i] = $arr;
 
                   $i++;
 
               }
 
           }
 
       }
 
       fclose($file);
 
       return $content;
 
   }

 
   function escape_string($data)
 
   {
 
       $result = array();
 
       foreach($data as $row)
 
       {
 
           $result[] = str_replace('"'''$row);
 
       }
 
       return $result;
 
     


Any advice is much appreciated.

I was thinking that maybe I'd be better using something like MySQL Local Load into a specific imports table and then working off that data.


  XML error: Invalid document end at line 1
Posted by: joergy - Today, 10:00 AM - Forum: CodeIgniter 2.x - Replies (1)

Under PHP 7 XML-RPC no longer works. You will see this error.
The two reasons:

XML-RPC expects its data in $HTTP_RAW_POST_DATA, which isn't available in PHP 7
in CI_Xmlrpcs::parseRequest() find its usage and get the data from

PHP Code:
file_get_contents("php://input"
instead.

PHP 7 doesn't understand this no longer:
PHP Code:
$CI->$method_parts['1']($m); 
use
PHP Code:
call_user_func(array($CI$method_parts[1]), $m); 
instead.

The same probably holds for:
PHP Code:
$this->object->$method_parts['1']($m); 
use
PHP Code:
call_user_func(array($this->object$method_parts[1]), $m); 

Well, I don't know, whether this is fixed in CI3 ...

Hope this helps.
joergy


  [Solved] Ajax pagination links triggers off canvas to open?
Posted by: wolfgang1983 - Today, 12:06 AM - Forum: General Help - Replies (1)

I am now using ajax for my codeigniter pagination but when I click on my pagination links It triggers the off canvas to open

How can I prevent the off canvas to open when I click on my pagination links?


PHP Code:
<script type="text/javascript">
$(
document).ready(function() {
var 
menuToggle = $('.toggle-button');
var 
menuToggleIcon menuToggle.find('.fa');
var 
offCanvas = $('.offcanvas');
var 
content = $('.content');

menuToggle.click(function() {
closeMenu(menuToggleIconoffCanvas);
});

content.click(function() {
    closeMenu(menuToggleIconoffCanvas);
});

function 
closeMenu(menuToggleIconoffCanvas) {
    menuToggleIcon.toggleClass('fa-indent fa-outdent');
   offCanvas.toggleClass('open');
}

}); 
</script> 



PHP Code:
<script type="text/javascript">
$(
document).ready(function() {
function 
load_users_data(page){
  $.ajax({
  url:"<?php echo base_url(); ?>dashboard/users_pagination/" page,
  method:"GET",
  dataType:"json",
  success:function(data) {
   $('#users_table').html(data.users_table);
   $('#user_pagination_link').html(data.pagination_link);
  }
  });
}

load_users_data(1);

$(
document).on("click"".user-pag li a", function(event){
  event.preventDefault();
  var page = $(this).data("ci-pagination-page");
  load_users_data(page);
});

});
</script> 


PHP Code:
<script type="text/javascript">
$(
document).ready(function() {
function 
load_users_data(page){
  $.ajax({
  url:"<?php echo base_url(); ?>dashboard/users_pagination/" page,
  method:"GET",
  dataType:"json",
  success:function(data) {
   $('#users_table').html(data.users_table);
   $('#user_pagination_link').html(data.pagination_link);
  }
  });
}

load_users_data(1);

$(
document).on("click"".user-pag li a", function(event){
  event.preventDefault();
  var page = $(this).data("ci-pagination-page");
  load_users_data(page);
});

});
</script> 



Attached Files
.php   Dashboard.php (Size: 3.13 KB / Downloads: 21)

  How to format template?
Posted by: PolkaDodge - Yesterday, 10:27 AM - Forum: Model-View-Controller - Replies (6)

Hi im new to codeigniter and im just wondering on how to format the data from a template.

I can format data coming from a row_array result since i dont need to loop it but how can i format data coming from a result_array()??


If i use foreach in controller to format the data i cant loop them in views.

Controller:

Code:
public function loadClients(){
    $clientsTotal = $this->client_list_model->getClientTotal();
    $activeCount = $this->client_list_model->activeCount();
    $inactiveCount = $this->client_list_model->inactiveCount();
    $archiveCount = $this->client_list_model->archiveCount();

    $data = array(
        'project_total' => $clientsTotal['projects_total'],
        'pending_total' => $clientsTotal['pending_total'],
        'on_going_total' => $clientsTotal['on_going_total'],
        'completed_total' => $clientsTotal['completed_total'],
        'cancelled_total' => $clientsTotal['cancelled_total'],
        'total_price' => number_format($clientsTotal['total'],2),
        'paid_total' => number_format($clientsTotal['paid_total'], 2),
        'balance_total' => number_format($clientsTotal['balance_total'],2),
        'held_price_total' => number_format($clientsTotal['held_price_total'],2),

        'client_total' => $clientsTotal['client_total'],
        'active_count' => $activeCount['active'],
        'inactive_count' => $inactiveCount['inactive'],
        'archive_count' => $archiveCount['archive']
    );

    $data['clients'] = $this->client_list_model->getClients();// I would like to format these results
    $data['title'] = 'Client List';

    $this->load->view('templates/header');
    $this->load->view('pages/activities');
    $this->parser->parse('pages/client_list', $data);
    $this->load->view('templates/footer');
}

Model:
Code:
function getClients(){
        $this->db->select("c.client_id, c.company_name, count(p.project_id) AS projects,
            count(CASE WHEN p.project_status = 'Pending' THEN p.project_status END) AS pending,
            count(CASE WHEN p.project_status = 'On Going' THEN p.project_status END) AS on_going,
            count(CASE WHEN p.project_status = 'Completed' THEN p.project_status END) AS completed,
            count(CASE WHEN p.project_status = 'Cancelled'THEN p.project_status END) AS cancelled,  
            sum(p.total_price) AS total_price, sum(p.paid) AS paid, sum(p.balance) AS balance,
            sum(p.held_price) AS held_price, c.client_status");
    $this->db->from('clients c');
    $this->db->join('projects p', 'c.client_id = p.client_id', 'LEFT');
    $this->db->group_by('c.client_id');
    $clients = $this->db->get();
    return $clients->result_array();
}


View:
Code:
{clients}
    <tr>
            <td class="left">{client_id}</td>
            <td class="left">{company_name}</td>
            <td>{projects}</td>
        <td>{pending}</td>
        <td>{on_going}</td>
        <td>{completed}</td>
        <td>{cancelled}</td>
        <td>{total_price}</td>
        <td>{paid}</td>
        <td>{balance}</td>
        <td>{held_price}</td>
        <td>
                <span>{client_status}</span>
            <a href="client_profile/{client_id}" class="view button">View</a>
        </td>
    </tr>
{/clients}

I would like to be able to number format or date format the result coming from the model in controllers which is
Code:
$data['clients'] = $this->client_list_model->getClients();


  priority of validation
Posted by: yuki - Yesterday, 09:03 AM - Forum: Libraries & Helpers - Replies (4)

I studying "Form Validation" while surfing the net.
It's written by much Website as follows.

Code:
$this->form_validation->set_rules("email", "E-MAIL", "required|trim|callback_validate_credentials");

More than one rule and callback are included by this example.

validate_credentials() is check whether the character string to which that was handed exists in the data base.

But even if a blank is sent, an required error message isn't output, and an error of callback is output.
I'd like to check the required confirmation first.
How should the order of priority be specified?


  base_url() returning ip instead of url in 3.1.3
Posted by: crouchkl - Yesterday, 08:52 AM - Forum: Issues - Replies (2)

I'm having a weird issue where base_url() is returning the IP address of the server instead of the actual URL. I have the site in a folder on the server, similar to another site that I have that's running codeigniter 3.0.6.

The older site is https://www.klccomputing.com/tracker and is running 3.0.6 and works just fine.
The newer site is https://www.klccomputing.com/icingOnTheCake and is running 3.1.3, but returns the IP.

Is there some sort of configuration change that would cause this difference?


  Search filter using ajax
Posted by: rohitwagh150 - Yesterday, 04:13 AM - Forum: General Help - Replies (1)

Hiii,

I have developed shopping website. But while searching product i have filter that using ajax but stuck somehow ....please help me...

here is my code....

Code:
 
    <div class="row" style="margin-bottom: -30px; border: 1px lightgray inset; background-image: url('<?php echo base_url();?>assets/images/headerbanner3.jpg')">
       <nav class="navbar-form" style="margin-left: 25%; ">
           <form action="<?php echo base_url();?>resource_controller/search_users" method="POST">
               <input type="hidden" id="multiskills" name="multiskills">
                                <script type="text/javascript">
                                        function allskill() {
                                        var mk = $('#selskill').val();
                                        document.getElementById('multiskills').value = mk;
                                    }
                                        </script>
                                        <select class="selectpicker" multiple data-live-search="true" id="selskill" name="selskill" required="required"
                                                data-live-search-placeholder="Search" data-actions-box="true">
                            <?php 
                            $sk=$this->skills_model->get_skills();
                            foreach ($sk->result() as $row) {
                                echo '<option>';
                                echo $row->name;
                                echo '</option>';
                            }
                            
                            ?>
                                </select>  
          <button type="submit" class="btn btn-success input-group" onclick="javascript:allskill()">
                                    <i class="fa fa-search"></i> Search</button>
        </form>
            <div style="margin-left: 80%"><a> sort by </a>
               <select name="filter" class="form-control">
                   <option>Qualification</option>
                   <option>Experience</option>
                   <option>Ranking</option>
               </select>
            </div>                               
      </nav>
    </div>
    <div class="container-fluid" style="">
<div class="modal-dialog  pull-left" style="width: 25%; ">
    <!-- Modal content-->
    <div class="modal-body">
        <div class="row">
            <article role="login" style="min-height: 400px;">
                <form name="filters" action="<?php echo base_url('resource_controller/view_div');?>">
                <div class="pull-left">
                    <h4 class="text-center"><i class="fa fa-filter"></i> Filter By Region </h4></div><br><br>
                    <div class="form-group">
                        <div class="regions">
                         <label class="check-inline">
                             <input type="checkbox" id="sangli" name="region[]" value="Sangli" class="category"
                                    onclick="javascript:updateregion()" 
                                    > Sangli</label><br>
                         <label class="check-inline">
                             <input type="checkbox" id="satara" name="region[]" value="Satara" class="category"
                               onclick="javascript:updateregion()" 
                               >Satara</label><br>
                        <label class="check-inline">
                            <input type="checkbox" id="kolhapur" name="region[]" value="Kolhapur" class="category"
                               onclick="javascript:updateregion()" 
                               >Kolhapur</label><br>
                        <label class="check-inline">
                            <input type="checkbox" id="solapur" name="region[]" value="Solapur" class="category"
                                   onclick="javascript:updateregion()" 
                                   >Solapur</label><br>
                            <input type="hidden" name="filterbyregion" id="filterbyregion"> 
                        <script type="text/javascript">
                            function updateregion() {
                                var textbox = "";
                                var rgns = [];
                             if(document.getElementById('sangli').checked) {
                                 if (textbox == "") {
                                     textbox += "Sangli";
                                 } else {
                                     textbox += ", Sangli";
                                 }
                                 rgns.push('sangli');
                                }
                                if(document.getElementById('satara').checked) {
                                  if (textbox == "") {
                                     textbox += "Satara";
                                 } else {
                                     textbox += ", Satara";
                                 }
                                 rgns.push('satara');
                                }
                                if(document.getElementById('kolhapur').checked) {
                                  if (textbox == "") {
                                     textbox += "Kolhapur";
                                 } else {
                                     textbox += ", Kolhapur";
                                 }
                                 rgns.push('satara');
                                }
                                if(document.getElementById('solapur').checked) {
                                  if (textbox == "") {
                                     textbox += "Solapur";
                                 } else {
                                     textbox += ", Solapur";
                                 }
                                 rgns.push('satara');
                                }
                                document.getElementById('filterbyregion').value = textbox;
                              //  document.filters.submit();
                                jQuery.ajax({
                                    url: '<?php echo site_url();?>resource_controller/view_div',
                                    type: "POST",
                                    data: {"txt": textbox},
                                    success: function() {
                                $('#filter_div').load('<?php echo site_url();?>resource_controller/view_div');
                                  },
                                    error: function(error) {
                                        console.log(error);
                                    }
                                 });
                            }
                            
                        </script>
                    <div class="panel group">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                            <h4 class="panel-title">
                                <a data-toggle="collapse" href="#collapse1">
                                    <i class="fa fa-plus"></i> More Regions</a>
                            </h4>
                            </div>
                            <div id="collapse1" class="panel-collapse collapse">
                        <div class="panel-body">
                        <?php $attribut = array("name" => "form", "id" => "form");
                            echo form_open("resource_controller/view_div", $attribut);?>
                            <script type="text/javascript">
                                function filterregion() {
                            document.getElementById('filterbyregion').value = document.getElementById('district').value;
                            $("#form").submit();
                            }
                            </script>
                            <div class="form-group">
                            <label class="col-md-3 control-label">State</label>
                            <div class="col-md-9">
                                <?php $attribut = 'id="state" class="form-control"';
                                    echo form_dropdown('state', $state, set_value('state'), $attribut); ?>
                            </div>
                            </div> <div class="clearfix"></div><br>
                            <div class="form-group">
                                <label class="col-md-3 control-label">District</label>
                                <div class="col-md-9">
                                <?php $attribut = 'id="district" class="form-control"';
                                $distattribut = array("name" => "form", "id" => "form");
                                    echo form_dropdown('district', $district, set_value('district'), $attribut,
                                            'onChange="javascript:filterregion()"'); ?>
                                </div>
                            </div><div class="clearfix"></div><br>
                            <div class="form-group">
                                <label class="col-md-3 control-label">Taluka</label>
                                <div class="col-md-9">
                                <?php $attribut = 'id="taluka" class="form-control"';
                                    echo form_dropdown('taluka', $taluka, set_value('taluka'), $attribut); ?>
                                </div>
                            </div>
                        <?php echo form_close(); ?>
                        </div></div>
                        </div>
                        <div class="clearfix"></div><br>
                        
                    </div>
                        </div></div>
                    <div class="pull-left">
                    <h4 class="text-center"><i class="fa fa-user"></i> Qualification </h4></div><br><br>
                    <div class="form-group">
                         <label class="check-inline">
                             <input type="checkbox" id="mcom" name="MCom"> MCom</label><br>
                         <label class="check-inline">
                        <input type="checkbox" id="ba" name="BA"> BA</label><br>
                        <label class="check-inline">
                        <input type="checkbox" id="hsc" name="HSC"> HSC</label><br>
                        <label class="check-inline">
                        <input type="checkbox" id="ssc" name="SSC"> SSC</label><br>
                    <div class="panel group">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                            <h4 class="panel-title">
                                <a data-toggle="collapse" href="#collapse2">
                                    <i class="fa fa-plus"></i> More Qualification</a>
                            </h4>
                            </div>
                            <div id="collapse2" class="panel-collapse collapse">
                        <div class="panel-body">
                            <select id="qualification" name="qualification" class="form-control">
                                
                            <?php 
                            foreach ($courses as $course) {
                                 ?>
                                <option><?php echo $course;?></option>
                                <?php
                             }
                            ?></select>
                        </div></div>
                        </div>
                        <div class="clearfix"></div><br>
                    </div>
                    </div>
                    <div class="pull-left">
                    <h4 class="text-center"><i class="fa fa-user"></i> Experience </h4></div><br><br>
                    <div class="form-group">
                         <label class="check-inline">
                             <input type="checkbox" id="exp" name="exp"> More than 5 years</label><br>
                         <label class="check-inline">
                        <input type="checkbox" id="exp5" name="exp5"> 2 to 5 years</label><br>
                        <label class="check-inline">
                        <input type="checkbox" id="exp2" name="exp2"> 0 to 2 years</label><br>
                        <label class="check-inline">
                            <input type="checkbox" id="fresher" name="Fresher"> Fresher</label><br><br><br>
                    </div> 
                    
                    <div class="pull-left">
                    <h4 class="text-center"><i class="fa fa-user"></i> Ranking </h4></div><br><br>
                        <div class="radio">
                            <label><input type="radio" name="ranking" value="4,5" id="rad1"
                                          onclick="javascript:ranking()">
                                <i class="fa fa-star"></i> <i class="fa fa-star"></i> <i class="fa fa-star"></i>
                                <i class="fa fa-star"></i> <i class="fa fa-star-o"></i> & up</label><br>
                                
                                <label><input type="radio" name="ranking" value="3,4,5" id="rad2"
                                              onclick="javascript:ranking()">
                                    <i class="fa fa-star"></i> <i class="fa fa-star"></i>
                                    <i class="fa fa-star"></i> <i class="fa fa-star-o"></i> 
                            <i class="fa fa-star-o"></i> & up</label><br>
                            
                            <label><input type="radio" name="ranking" value="2,3,4,5" id="rad3"
                                          onclick="javascript:ranking()">
                                <i class="fa fa-star"></i> <i class="fa fa-star"></i>
                                <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> 
                            <i class="fa fa-star-o"></i> & up</label> <br>
                                <label><input type="radio" name="ranking" value="1,2,3,4,5" id="rad4"
                                              onclick="javascript:ranking()">
                                    <i class="fa fa-star"></i> <i class="fa fa-star-o"></i>
                                    <i class="fa fa-star-o"></i> <i class="fa fa-star-o"></i> 
                            <i class="fa fa-star-o"></i> & up</label><br>
                            <input type="hidden" id="selrank" name="selrank">
                            <script type="text/javascript">
                            function ranking() {
                                alert('ranking');
//                                if(document.getElementById('rad1').checked) {
//                                    document.getElementById('selrank').value = document.getElementById('rad1').value;
//                                    $("#rankingform").submit();
//                                }
//                                if(document.getElementById('rad2').checked) {
//                                    document.getElementById('selrank').value = document.getElementById('rad2').value;
//                                    $("#rankingform").submit();
//                                }
//                                if(document.getElementById('rad3').checked) {
//                                    document.getElementById('selrank').value = document.getElementById('rad3').value;
//                                    $("#rankingform").submit();
//                                }
//                                if(document.getElementById('rad4').checked) {
//                                    document.getElementById('selrank').value = document.getElementById('rad4').value;
//                                    $("#rankingform").submit();
//                                }
                            }    
                            </script>
                        </div>
                    </form>
            </article>
        </div>
    </div>
</div>

<div class="modal-dialog pull-right" id="filter_div" style="width: 75%; height: auto;">
    <?php $this->load->view('/web/filtered_resources');?>
    <!--<iframe src="<?php //$this->load->view('/web/filtered_resources');?>"></iframe>-->
</div>
</div></div>

Code:
public function search_users() {
            $rgn = str_replace(",", "','", $this->input->post('filterbyregion'));
            $rank = str_replace(",", "','", $this->input->post('ranking'));
            $exp = str_replace(",", "','", $this->input->post('selexperiance'));
            $qual = str_replace(",", "','", $this->input->post('qualification'));
            //$sk = $this->session->userdata('skills');
            $mskills = str_replace(",", "','", $this->input->post('multipleskills'));
            $multiskills = str_replace(",", "','", $this->input->post('multiskills'));
            $filterskills = str_replace(",","','", $this->input->post('filterskills'));
            $sk = "";
            if ($mskills != "") {
                $sk = $mskills;
            } else 
            if ($multiskills != "") {
                $sk = $multiskills;
            } else 
            if ($filterskills != ""){
                $sk = $filterskills;
            }
            $this->q['h'] = $this->resource_model->search_users($sk,$rgn,$qual,$exp,$rank);
            $this->q['state'] = $this->place_model->get_state();
            $this->q['district'] = $this->place_model->get_district();
            $this->q['taluka'] = $this->place_model->get_taluka();
            $this->q['courses'] = $this->course_model->get_all_course_names();
            if(isset($this->q['h']) && $this->q['h']->num_rows() > 0)
            {
                $this->load->view('/web/searched_resources',$this->q);
            }else {
                echo '<script>alert("No resources are available!")</script>';
                $this->load->view('/web/searched_resources');
            }
            return array();
        }



Attached Files
.php   search_controller.php (Size: 1.18 KB / Downloads: 39)
.php   resource_controller.php (Size: 12.72 KB / Downloads: 36)

  Create custom link url for users
Posted by: valkaycelestino - Yesterday, 03:12 AM - Forum: General Help - Replies (5)

I have a membership site where people can sign up for an account using their name, phone number and password of choice. The information entered during registration is stored in a MySQL database table called 'users'. The primary key in the users table is the phone number. During sign up, the user has the option to type the phone number of his referrer into 'referrer' field.
I have all these set up and working fine, but I want to enhance the site some more, by:

  1. Creating a unique referral link for users which will have their phone number appended to their link. I want to track which user referred others to my site so I can reward them.
  2. When they share this link, and people click on it, it will take them to the registration page (register.php). On that page he phone number of the referrer will be set (and locked) in the 'referrer' box.
I am new to php and Code Igniter. I have toured the internet looking for a solution to this but i just can't find any. Please any help will be much appreciated.



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