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

  having issue with join only recent row
Posted by: dsingh948 - 03-16-2018, 12:01 PM - Forum: General Help - No Replies

So i have been working with codeigniter for three years, and for database queries most of the time i use active records, and design database in a way that avoids complex queries .

But current project i am working on has recurring membership plans and i am saving them in a table with start and end date .


membership table

other table is 

name etc

now at the time of login i have to do a joing with table members and membership but joins needs to return only recent entry for that member from membership table.

I can do it by simple queries first get the member and then membership recent row for that member and then do the comparison, but there would be case where i would need to use pagination and in that case i will need a single query of join.

which can do following.


get member information from members table

whose (enddate+1 day) only for recent entry for that member from membership table is smaller than currentdate.

if the query can be done using active records that would be great help.

Any help would be greatly appreciated.

Thank You guys.

Posted by: buzztomi - 03-15-2018, 08:22 PM - Forum: Best Practices - Replies (7)


I have an AJAX FORM that using form_open() fucntion.

If $config['csrf_protection'] = TRUE, the FORM doesnt work.
If $config['csrf_protection'] = FALSE, the FORM works fine.

Is it posibble to keep using CSRF Token in AJAX FORM?

  Session not persisting while upgrading from 3.0.4 to 3.1.7
Posted by: rkorebrits - 03-15-2018, 09:48 AM - Forum: General Help - Replies (2)

I'm busy upgrading from 3.0.4 to 3.1.7 and having issues with session. I've tested this on PHP 7.0 and PHP 7.2
I've seen a few other issues here regarding session on PHP 7.x with late versions of CI, but not any with resolution it seems.
When I run this:

   $this->session->set_userdata('test', 'test');
   print ($this->session->userdata('test'));

it prints "test" just fine. Then when I remove the 

 and reload the page, it's empty.

Either sessions aren't being stored, or they are being cleared. What could this be?

  Question mark problem
Posted by: theedo - 03-15-2018, 09:44 AM - Forum: General Help - Replies (5)

Hi to everyone! I'm making a CMS based on Codeigniter for a project. But I've a (maybe, I don't know) "big" problem.

I've a database with some users registered. Some of these has the ? in their name and when I go to their profile page I see "404 Not Found".

Now, I load profile in this way: (the controller)

PHP Code:
public function view($username){ 

and I did a route:
PHP Code:
$route['profile/(:any)'] = "profile/view/$1"
Instead: if the username is ?ABC, I'll have 404 on exxample.com/profile/?ABC.
I think that I allowed the ? in the permitted_uri:
PHP Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-?'

Do you have some idea to solve my problem? thank you!

  One controller to load the same form (empty or populated)
Posted by: janeiro - 03-15-2018, 08:50 AM - Forum: General Help - Replies (1)

1. I'd like to create one controller to add or edit article and load only one view (empty form or populated form)

The code I've attached works and it's close to what I want but it has two different views with the same form and two controllers for add and edit data.

2. What happens when user sends the form? Let's say we have field with name="username" value="some_value"
How can I retrieve some_value in view file? Is it a variable or an array?

Can you help please?

Attached Files
.php   Article.php (Size: 2.8 KB / Downloads: 6)
.php   Article_model.php (Size: 1.12 KB / Downloads: 5)
.php   add.php (Size: 555 bytes / Downloads: 5)
.php   edit.php (Size: 917 bytes / Downloads: 5)
.php   index.php (Size: 510 bytes / Downloads: 4)

  xss clean issue
Posted by: michaelv - 03-15-2018, 07:58 AM - Forum: Issues - Replies (4)

CI 3.1.5
i have an issue with a form validation +xss_clean,
input string is : route val de soane

->set_rules('adresse', 'Adresse', 'required|xss_clean|trim|max_length[255]')...

>route val de soane

>routeval de soane

the xss_clean feature remove the space beetwen route & val

any way to avoid this?

sytem/core/Security.php line 448 if i remove 'eval' from the $words array no probleme

Question Special characters and their output (utf-8)
Posted by: Allertaler - 03-15-2018, 07:33 AM - Forum: General Help - Replies (4)

I struggle with the problem that special characters (Ö, Ü, Ä, ß) are not output correctly. I have check these points:

- <meta charset="utf-8">
- $config['charset'] = 'UTF-8';
- database: utf8_unicode_ci

I have already written a function, that works even with normal output:

PHP Code:
function utf8_ausgabe ($str) {

[Image: cn1.jpg]

... but in form inputs, it doesn't work. Of course, as well as the '&' is converted.

without convert function:
[Image: cn2.jpg]
with convert function:
[Image: cn3.jpg]

Do you have a solution for this?

Thanks in advance Blush

  Sending ID to a different table after data has been added
Posted by: kirasiris - 03-14-2018, 08:03 PM - Forum: General Help - Replies (2)

So I have a method in which I display the categories which are coming from ci_terms table using this:

PHP Code:
            // Select Categories    
$categories_options = array();
$categories_options[0] = 'Select Categories';
$categories_list $this->Terms_model->get_list();
$categories_list as $cat){
$categories_options[$cat->term_id] = $cat->title;
$data['categories_options'] = $categories_options

After that I do an insert  into my ci_posts table and it works great!; using this:

PHP Code:
    // Page Data
          $data = array(
'user_id'        => $this->input->post('user_id'),
'slug'            => $slug,
'title'            => $this->input->post('title'),
'post_image'    => $post_image,
'body'            => $this->input->post('body'),
'status'        => $this->input->post('status'),
'is_featured'    => $this->input->post('is_featured'),
'is_commented'    => $this->input->post('is_commented'),
'order'            => $this->input->post('order'),
'type'            => 'post',
           // Insert Page

This is what I have in my view to display and post the categories:

PHP Code:
   <!-- Post Categories -->
= array(
'class'        => 'form-control js-example-basic-multiple',
'multiple'    => 'multiple',
    <div class="form-group">
        <?= form_label('Categories','categories'); ?>
        <?= form_dropdown('categories[]'$categories_options0$data); ?>

Now in order to make it possible to post an id without having to pass a parameter in the method(for what I know).

I will have to post whatever data I want(that's the previous block of code in the controller). Now after that insert page(comment in the controller), I will obtain the id of the categories that were passed in the view by doing this(I hope I could make myself clear on this):

PHP Code:
            // Insert Categories into CI_TERMS_TAXONOMY - term_taxonomy_id, term_id, type, body, parent_id, count
$categories $this->Terms_model->get_list();
$data = array(
'term_taxonomy_id'    => $this->db->insert_id(),
'term_id'            => $categories->id,
'type'                => 'category',

So far, it only trows me an error of term_id cannot be null.

Any feedback would be very appreciated.

If you notice, I'm trying to build something similar to WordPress regarding its relationship between the datatables "wp_terms, wp_terms_taxonomy, wp_terms_relationship".

Thanks in advance.

  question about module in application
Posted by: danielcr_2018 - 03-14-2018, 05:59 PM - Forum: General Help - Replies (3)

Hi, I've been asked to develop an application with two modules, an online store for selling digital books and the other module is a special page where my client wants to post poems and let the users put comments on the publications. This page must look like facebook's news feed. I think the closest thing similar to this is a forum. 

I don't know if I should include another application into my application or write the code myself. Your comments are appreciated.

  404 not found!
Posted by: richb201 - 03-14-2018, 12:22 PM - Forum: General Help - Replies (17)

I am getting  a 404 error from this GET 

background.js:27 GET http://localhost/subit_backend.php 404 (Not Found)
background.js:27 XHR failed loading: GET "http://localhost/subit_backend.php".

            var xhr = new XMLHttpRequest();
            xhr.onerror = function() { alert('error'); };
            xhr.open("GET", "http://localhost/subit_backend.php", true);

my Document Root in httpd.conf is:

DocumentRoot "C:/xampp/htdocs/sub_crud"

<Directory "C:/xampp/htdocs/sub_crud">

subit_backend.php is in my controllers directory. 

where is my path going wrong?

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