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



Search Forums

(Advanced Search)

Forum Statistics
» Members: 10,847
» Latest member: amankumar
» Forum threads: 67,473
» Forum posts: 422,104

Full Statistics

Latest Threads
CodeIgniter 4 Proposed Ro...
Forum: CodeIgniter 4 Development
3 hours ago
» Replies: 76   » Views: 113,372
problems with Uncaught Sy...
Forum: General Help
3 hours ago
» Replies: 0   » Views: 13
CodeIgniter 3.1.8 Release...
Forum: News & Discussion
6 hours ago
» Replies: 14   » Views: 2,124
Help in converting vanill...
Forum: General Help
11 hours ago
» Replies: 6   » Views: 101
application modules for c...
Forum: Lounge
11 hours ago
» Replies: 1   » Views: 58
I want to wildcat with ac...
Forum: General Help
Today, 08:14 AM
» Replies: 1   » Views: 60
Problem with valid_email ...
Forum: General Help
Today, 07:21 AM
» Replies: 5   » Views: 169
Getting day, month and ye...
Forum: General Help
Today, 07:19 AM
» Replies: 6   » Views: 195
Codeigniter Pagination Us...
Forum: General Help
Today, 04:48 AM
» Replies: 1   » Views: 76
Forum: Best Practices
Today, 04:46 AM
» Replies: 7   » Views: 293

  Forward foreach query
Posted by: Germanikus - 03-19-2018, 09:07 AM - Forum: Regional User Groups - No Replies

Hello everybody,
How can I pass on a query that is on a particular line in FOREACH?
So I want to let the dedication that comes from the

$this->db->set('tb_artikel_anzahl', $this->input->post('edit_karte_menge')[$artikel_id]);
be entered in the line of
$this->db->set('tb_rechnung_menge', $this->input->post('edit_artikel_anzahl'));

PHP Code:
<?php echo form_open('Rechnung/update_rechnung'); ?>
            <input type="hidden" name="edit_rechnung_id" value="<?php echo $get_rechnung['tb_rechnung_id']; ?>">
            <div class="modal-body">
                <div class="row">
                    <div class="col-md-1"><h4><label class="label label-success">#</label></h4></div>
                    <div class="col-md-9"><h4><label class="label label-success">Karten Information</label></h4></div>
                    <div class="col-md-1"><h4><label class="label label-success"><?php echo $this->lang->line('all_tag_preis'); ?></label></h4></div>
                    <div class="col-md-1"><h4><label class="label label-success">Aktion</label></h4></div>
<?php foreach ($view_rechnung_karte as $warenkorb_karte): ?>
                <div class="row">
                    <input type="text" name="edit_artikel_id[<?php echo $warenkorb_karte['tb_artikel_id']; ?>]" value="<?php echo $warenkorb_karte['tb_artikel_id']; ?>">
                    <div class="col-md-1"><input type="text" class="form-control input-sm" name="edit_karte_menge[<?php echo $warenkorb_karte['tb_artikel_id']; ?>]" value="<?php echo $warenkorb_karte['tb_artikel_anzahl']; ?>"></div>
<?php endforeach;
    foreach (
$view_rechnung_produckt as $warenkorb_produckt):
                <div class="row">
                    <input type="text" name="edit_artikel_id[<?php echo $warenkorb_produckt['tb_artikel_id']; ?>]" value="<?php echo $warenkorb_produckt['tb_artikel_id']; ?>">
                    <div class="col-md-1"><input type="text" class="form-control input-sm" name="edit_karte_menge[<?php echo $warenkorb_produckt['tb_artikel_id']; ?>]" value="<?php echo $warenkorb_produckt['tb_artikel_anzahl']; ?>"></div>
<?php endforeach; ?>
            <div class="modal-footer">
                <button type="submit" class="btn btn-success btn-xs"><?php echo $this->lang->line('all_button_save'); ?></button>
                <button type="button" class="btn btn-danger btn-xs" data-dismiss="modal">Abbrechen</button>
<?php echo form_close(); ?>

PHP Code:
            public function update_rechnung($slug)
                    foreach (
$this->input->post('edit_artikel_id') as $artikel_id)
// $this->db->set('tb_artikel_preis', floatval(str_replace(',', '.', $this->input->post('add_preis')[$artikel_id])));
                            // $this->db->set('tb_artikel_kunde', $kunde_id);
                            // $this->db->set('tb_artikel_rechnung', $slug);
                            // $this->db->set('tb_artikel_time_rese', date('Y.m.d H:i:s'));
                            // $this->db->set('tb_artikel_status', 2);
                            // $this->db->set('tb_artikel_anzahl', 'tb_artikel_anzahl +'.$this->input->post('edit_karte_menge')[$artikel_id], FALSE);


  Procedure to bump an old Issue?
Posted by: Daneel Trevize - 03-19-2018, 08:42 AM - Forum: CodeIgniter 3.x - Replies (1)

I recently encountered an issue in CI's Query Builder, one that has been discovered by others before me, and already raised as a Pull Request (#4186).
However, I don't immediately see an Issue# for this, and it seems that their PR isn't consistent with the line numbering of CI 3.1.17.

I commented(#374227328) on the PR with my details & fix suggestion, but just want to check if this was the best place to leave this update, or if a fresh Issue would be best, or if I've just missed a link to the original one?
An additional complication is that the PR is from 2015 and seems to be tagged for CI 3.1, but clearly didn't make it in & get closed then. Yet also it appears tagged for 3.2 with the current minor code fix, rather than the one I explain would be better at handling all logical cases.

  hook doesn't redirect me
Posted by: Meury - 03-19-2018, 06:29 AM - Forum: General Help - Replies (5)

Hi everyone,

(Sorry for my english)

I try to use hooks... It works but I've a small problem.

I said to my hook: IF condition OK -> do...

but I would like : IF condition not OK -> continue

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Maintenance extends CI_Controller {
   public function index ()
       $this->CI =& get_instance();
       $this->CI->options_params = $this->CI->m_options->get_options();
       $off   = new DateTime($this->CI->options_params[0]->off_ligne);
       $today = date("Y-m-d H:i:s");
       $now   = new DateTime($today);
       $interval = $now->diff($off);
       $decal    = $interval->format('%a');
       $signe    = $interval->format('%R');
         if ($this->CI->options_params[0]->maintenance == 1 && $this->config->item('acces')[$_SERVER['mail']] === 'admin')
             if ($signe === "-")
                 echo "<div> TOTO </div>";

When the condition is ok... it's good, the message is displayed and the application doen't continue...
but when the condition is not ok... I've a blank page ... I would like that the application continue normaly.

Someone to help me ?

  404 index not found
Posted by: aminbaik - 03-19-2018, 05:27 AM - Forum: Installation & Setup - Replies (2)


i have a web application that is work on wamp on windows server and its work fine, i moved the application folder to linux ubuntu 16.4 with apache.

i see the permission and apahe config.
when i try to open the application is't give me 404 page not found
under ci log the error is page not found index
i enable devlopment mode but no error found.
i change the log level to 4
the log file:
INFO - 2018-03-16 23:20:10 --> Config Class Initialized
INFO - 2018-03-16 23:20:10 --> Hooks Class Initialized
DEBUG - 2018-03-16 23:20:10 --> UTF-8 Support Enabled
INFO - 2018-03-16 23:20:10 --> Utf8 Class Initialized
INFO - 2018-03-16 23:20:10 --> URI Class Initialized
INFO - 2018-03-16 23:20:10 --> Router Class Initialized
INFO - 2018-03-16 23:20:10 --> Output Class Initialized
INFO - 2018-03-16 23:20:10 --> Security Class Initialized
DEBUG - 2018-03-16 23:20:10 --> Global POST, GET and COOKIE data sanitized
INFO - 2018-03-16 23:20:10 --> Input Class Initialized
INFO - 2018-03-16 23:20:10 --> Language Class Initialized
ERROR - 2018-03-16 23:20:10 --> 404 Page Not Found: /index
i tried to change database to wrong settings and its give me the same error with same log.


  How query generates in controller,, without any function call to loaded Model ?
Posted by: Haseeb - 03-19-2018, 12:34 AM - Forum: General Help - Replies (2)

Hello, Hi to all

i am some novice ,

i have FusionInvoice from Github, i am unable to understand, how its controller is getting query result from model, where the function not exist in model.

in its Quotes/Create Quote Modal,  Client Name filed has .TypeAhed plugin,

Client Name : $.post("<?php echo site_url('clients/ajax/name_query'); ?>"

The Clients/Ajax Controller has function

PHP Code:
 public function name_query()
        // Load the model

        // Get the post input
        $query $this->input->post('query');

        $clients $this->mdl_clients->select('client_name')->like('client_name'$query)->order_by('client_name')->get(array(), FALSE)->result();

        $response = array();

        foreach ($clients as $client)
            $response[] = $client->client_name;

        echo json_encode($response);

But the mdl_clients  has no "select" function defined,, 
but yes , there is a function called  "default_select",  but its totally different than the one passed as in above controller to $clients.

the default_select in mdl_cleints is as following
PHP Code:
public function default_select()
        $this->db->select('SQL_CALC_FOUND_ROWS fi_client_custom.*, fi_clients.*'FALSE);

Can any one help please how controller is getting query data ?  As in controller,, only field name is given in query, without table name,, so how its doing then ?

Any help will be appericiated

  Why does sending account activation email from Codeigniter 3 fail?
Posted by: Ajax30 - 03-18-2018, 05:31 AM - Forum: General Help - Replies (1)

I am working on a Register and Login application with CodeIgniter 3.1.4 and Twitter Bootstrap.

When a user registers, an email should be send to the address he/she provided, with an account confirmation link. The problem is that the confirmation email does not send.

In the Usermodel I have:

public function activationEmail($first_name='', $last_name='', $email='', $verification_key='') {
   $config = array(
       'useragent' => 'CodeIgniter',
       'protocol' => 'mail',
       'mailpath' => '/usr/sbin/sendmail',
       'smtp_host' => 'localhost',
       'smtp_user' => '[email protected]',
       'smtp_pass' => '******',
       'smtp_port' => 465,
       'smtp_timeout' => 55,
       'wordwrap' => TRUE,
       'wrapchars' => 76,
       'mailtype' => 'html',
       'charset' => 'utf-8',
       'validate' => FALSE,
       'priority' => 3,
       'crlf' => "\r\n",
       'newline' => "\r\n",
       'bcc_batch_mode' => FALSE,
       'bcc_batch_size' => 200,
   $messg = 'Wellcome, '. $first_name . ' ' . $last_name . '! Click the <strong><a href="'.site_url('/signin/signin'. $verification_key).'">confirmation link</a></strong> to confirm your account.';

   $this->load->library('email', $config);
   $this->email->from('[email protected]','Razvan');
   $this->email->subject('Account activation');
   return $this->email->send();

In my Signup controller I have this code:

public function signup() {
   $this->form_validation->set_rules('first_name', 'First name', 'required');
   $this->form_validation->set_rules('last_name', 'Last name', 'required');
   $this->form_validation->set_rules('email', 'Email', 'required|trim|valid_email');
   $this->form_validation->set_rules('password', 'Password', 'required|min_length[6]');
   $this->form_validation->set_rules('cpassword', 'Confirm password', 'required|matches[password]');
   $this->form_validation->set_error_delimiters('<p class="error">', '</p>');

   if ($this->form_validation->run()) {
       $first_name = $this->input->post('first_name');
       $last_name = $this->input->post('last_name');
       $email =  $this->input->post('email');
       $password = $this->input->post('password');
       $verification_key = md5($email);
       $date_created = date('Y-m-d H:i:s');
       $date_updated = date('Y-m-d H:i:s');
       $active = 0;
       // Load user model

       // If email does not already exist in the database
       // signup new user
       if (!$this->Usermodel->email_exists($email)) {
           if ($this->Usermodel->user_register($first_name, $last_name, $email, $password, $verification_key, $date_created, $date_updated, $active) && $this->Usermodel->activationEmail($first_name, $last_name, $email, $verification_key)) {

               $this->session->set_flashdata("signup_success", "Your account has just bean created. You must confirm it before you can sign in. We have send you a confirmation email at $email for this purpose.");

           } else {
               // unless sigup does not fail for whatever reason
               $this->session->set_flashdata("signup_failure", "We ware unable to create your account.");
       } else {
           // If email is already in the database
           // urge user to sign in (redirect to signup page too)
           $this->session->set_flashdata("email_exists", "The email address $email already exists in the database. Please signin.");
   } else {

Not only does the email NOT send but I get this error at signup:

Message: Missing argument 2 for Usermodel::activationEmail(), called in path/to/application/directory/ciauth/application/controllers/Signup.php on line 42 and defined

Filename: models/Usermodel.php

Line Number: 27

The sign up doAes happend, but the verification email is not send. I am not doing this from a local XAMPP/WAMP/MAMP server, but from a "live" one.
What am I doing wrong?

  Problem with valid_email return true for invalid email address
Posted by: zjonsnowz - 03-17-2018, 12:35 PM - Forum: General Help - Replies (5)


I'm new to CI and just setup and working on the sign up form, but some how the valid_email rule in form validation is not working. I have tried the function valid_email() too and it's still not working. How come this email "a!b#c$e%g^h&j*[email protected]" can pass the validation?

PHP Code:
('BASEPATH') OR exit('No direct script access allowed');

Welcome extends CI_Controller
    public function 

valid_email('a!b#c$e%g^h&j*[email protected]'))
'valid email';
'invalid email';

This code is displaying "valid email". Did I miss something? Please help.

  Eclipse PDT Plugin for CodeIgniter
Posted by: carlospauluk - 03-17-2018, 09:31 AM - Forum: Installation & Setup - Replies (6)


I´m a long time java developer, used to Eclipse tools. Now I´m starting development with PHP and CodeIgniter. I'm trying to use Eclipse PDT, but as far as I looked, there's no support for work with CodeIgniter (code completion).

Does anyone knows how to get this working?


  Empty data result in query MS SQLSERVER "OUTPUT INSERTED.*"
Posted by: nguyenthao - 03-16-2018, 09:59 PM - Forum: General Help - No Replies

Hi Every body!

I using codeigniter Framework with database Microsoft SQL SERVER 2016.

I have T-SQL

Insert into tbl_student('subject', 'name')  output inserted.name values('laptrinhvb.net', 'Nguyễn Thảo')

I'm run T-sql in sqlserver management result => "Nguyễn Thảo".

I use T sql in php

$this->db->query("Insert into tbl_student('subject', 'name')  output inserted.name values('laptrinhvb.net', 'Nguyễn Thảo')")->row()->name;

Result data empty!

Please help me! Smile

Sad Session: performance lock problem
Posted by: alexhava - 03-16-2018, 12:56 PM - Forum: Libraries & Helpers - Replies (2)

Hi all
I have turned on Memcache driver for sessions but got delay for a 5-20 seconds, page loading slow and with delays. I figured out that locks caused delay. I put session_write_close to the end of the scripts but that didn't help to solve the problem. How can I fix this?


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