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

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 8,143
» Latest member: Yacine31
» Forum threads: 65,659
» Forum posts: 412,929

Full Statistics

Latest Threads
CodeIgniter 3.1.4 release...
Forum: News & Discussion
19 minutes ago
» Replies: 12   » Views: 3,176
Add option in select and ...
Forum: General Help
2 hours ago
» Replies: 0   » Views: 18
Session: Error while tryi...
Forum: CodeIgniter 3.x
3 hours ago
» Replies: 11   » Views: 2,183
Combine input val ajax fr...
Forum: General Help
3 hours ago
» Replies: 1   » Views: 37
CI4 Database Pessimistic ...
Forum: CodeIgniter 4 Feature Requests
4 hours ago
» Replies: 1   » Views: 50
Class stdClass not found
Forum: General Help
6 hours ago
» Replies: 2   » Views: 26
Want a Codeigniter Query
Forum: General Help
9 hours ago
» Replies: 2   » Views: 115
CodeIgniter has some erro...
Forum: General Help
9 hours ago
» Replies: 3   » Views: 105
Exact location of CI file...
Forum: Installation & Setup
Yesterday, 10:10 PM
» Replies: 10   » Views: 111
No Controller Call In Con...
Forum: CodeIgniter 4 Feature Requests
Yesterday, 05:59 PM
» Replies: 0   » Views: 40

 
  [split] Community Auth - session variables?
Posted by: oscar1925 - 03-20-2017, 08:34 AM - Forum: Addins - Replies (1)

How to add session variables so that i can retrieve it in any of my views?


  Codeigniter Cross Script Request Forgery and CRUD libraries
Posted by: Gtya - 03-20-2017, 06:41 AM - Forum: Addins - Replies (1)

Dear,

so while learning CodeIgniter i noticed that the CSRF is an interesing features, but all the libraires i have found like Grocery CRUD have trouble with this functionality.

is there somewhere a good complete explanation about how to make them compatible with theses functionalities?

(as i think that lowering down the security is not a good option and such CSRF should always be used)

are you aware of any CRUD libraries that is fully functional/compatible straight from the box with CodeIgniter 3 / stable and these security options?

thanks in advance Smile


  Sessions not working on php 7.1.3
Posted by: zstk42 - 03-19-2017, 06:30 AM - Forum: Issues - Replies (1)

Hello

I'm having a hard time getting CI sessions to work with one of my installs. My development machine has php 7.1 installed (windows) with the latest version of CI (3.1.3) and it runs just fine. However when I tried the same code on my Ubuntu machine (7.1.3-2) suddenly all my sessions just don't work anymore. No logs are made, even with the highest threshold. 

Is there a workaround for this or is CI not ready yet?


  MySQL, Querybuilder, Controller problems... ERR 2014
Posted by: cyrus - 03-19-2017, 05:48 AM - Forum: General Help - Replies (4)

Hello everyone,

I'm new to CI and haven't been into php for quite a while and now I'm stuck and don't get it to run. Tought it'd be an easy task, so in short:

Using a controller "Suppliers" which has a method "details", which will then call a view containing general details and a list of entries from another table. The view tells me that an error occured: 

Code:
Error Number: 2014

Commands out of sync; you can't run this command now

So to get the info needed:

My Controller
PHP Code:
class Suppliers extends CI_Controller {

 
       public function __construct()
 
       {
 
           parent::__construct();
 
           $this->load->model('suppliers_model');
 
           
            
            
//Check if logged in already
 
           session_valid();
 
       }

public function 
details($id NULL)
 
       {
 
           $data['supplier'] = $this->suppliers_model->get_supplier($id);
            if (empty($data['supplier'])) show_404();

            $data['certificates'] = $this->suppliers_model->get_supplier_certificates($id);


            $data['title'] = $this->lang->line('supplier'FALSE) . ': ' $data['supplier']['name'];

            $this->load->view('templates/header'$data);
            $this->load->view('suppliers/details'$data);
            $this->load->view('templates/footer');
 
       

My Model
PHP Code:
class Suppliers_model extends CI_Model {

 
       public function __construct()
 
       {
 
           $this->load->database();
 
       }

 
       public function get_suppliers($id FALSE)
 
       {
 
           if ($id === FALSE)
 
           {
 
               //$query = $this->db->get('suppliers');
 
               $query $this->db->query('call read_supplier_list()');
 
               return $query->result_array();
 
           }


 
           $query $this->db->query('call read_supplier(' $id ')');
 
           //$query = $this->db->get_where('suppliers', array('id' => $id));

 
           return $query->row_array();
 
       }

 
       public function get_supplier_certificates($supplier_id)
 
       {
 
           //$query = $this->db->query('call read_supplier_certificates(' . $supplier_id . ')');
 
           $query $this->db->get_where('supplier_certificates', array('supplier_id'$supplier_id));
 
           return $query->result_array();
 
       


So, pleasy tell me where I'm wrong... I dont' get it Sad


  [Solved] Unable to get data ajax using get
Posted by: wolfgang1983 - 03-19-2017, 05:27 AM - Forum: General Help - Replies (2)

I am unable to get any data when I echo json

What I am trying to do is when use selects a image it will upload it and then display files beloing to that question_code

The upload ajax part works fine just can not get the data.

Question Why would the display attachment function not be able to get the data? the when $question_code is correct

The get url out puts on firebug


Code:
http://project.com/question/ask/display_attachments/9471523086



PHP Code:
$('#button-upload input[name="file"]').on('change', function() {
    $.ajax({
        url"<?php echo base_url('question/ask/attachments');?>",
        type'post',
        dataType'json',
        data: new FormData($('#form-ask')[0]),
        cachefalse,
        contentTypefalse,
        processDatafalse,
        success: function(json) {
            // Would not like the second ajax here 
        }
    });

    $.ajax({
        url"<?php echo base_url('question/ask/display_attachments');?>/" + $('#question_code').val(),
        type'get',
        dataType'json',
        success: function(json) {
        }
    });
}); 


Controller Function

PHP Code:
public function display_attachments($question_code) {
    $data = array('attachments' => '');

    $this->db->where('question_code'$question_code);
    $query $this->db->get('attachment');

    if ($query->num_rows() > 0) {

        foreach ($query->result_array() as $result) {
            $data['attachments'][] = array(
                'attachment_id' => $result['attachment_id'],
                'file_name' => $result['file_name']
            );
        }

    }

    echo json_encode($data);


  Cart discount library example
Posted by: sams.arifin - 03-19-2017, 12:46 AM - Forum: Libraries & Helpers - Replies (5)

Hi, 

i have been using codeigniter cart for handling online shop site. I store multiple item into the cart. But i have a problem when the item has discount to reduce the amount total of the cart. I have no idea how to do it if the discount stored in database. The discount my consist of percentage and decimal value. May someone please help me the algorithm or the code  example to handle the discount cart.

Thanks


  How to make this query a little bit more readable?
Posted by: meSmashsta - 03-18-2017, 11:43 AM - Forum: General Help - Replies (6)

PHP Code:
        $fname_format "CONCAT(b.last_name, ', ', b.first_name, ' ', b.middle_name) AS full_name";
        
$this->db->select("a.id, b.id AS employee_id, {$fname_format}, c.id AS machine_id, c.title AS machine, d.title AS hstatus, a.created_on, a.action_on, a.edit_on, a.problems_encountered, a.corrective_action,a.root_caused,a.remarks,a.item_replaced");
        
$this->db->from("reports AS a");
        
$this->db->join("employees AS b""b.id = a.employee_id");
        
$this->db->join("machines AS c""c.id = a.machine_id");
        
$this->db->join("hstatus AS d""d.id = a.hstatus_id");
        return 
this->db->get()->result_array(); 

Look at the select part, it's so ugly...


  Query Builder "FROM * table AS a"
Posted by: meSmashsta - 03-18-2017, 11:21 AM - Forum: General Help - Replies (1)

How do you do that in code igniter? I have this Stored Procedure that I want to reproduce in Codeigniter's Query Builder. Thanks in advance guys!

Code:
DELIMITER //

CREATE PROCEDURE get_reports(
IN record_start INT,
IN records_to_retrieve INT
)
BEGIN
   
   DECLARE r_start INT DEFAULT 0;
   DECLARE r_retrieve INT DEFAULT 0;
   SET r_start = record_start - 1;
   SET r_retrieve = record_start * records_to_retrieve;
   
   SELECT a.id,
           b.id AS employee_id,
           CONCAT(b.last_name, ", ", b.first_name, " ", b.middle_name) AS full_name,
           c.id AS machine_id,
           c.title AS machine,
           d.title AS hstatus,
           a.created_on,
           a.action_on,
           a.edit_on,
           a.problems_encountered,
           a.corrective_action,
           a.root_caused,
           a.remarks,
           a.item_replaced
   FROM reports AS a
   INNER JOIN employees AS b ON b.id = a.employee_id
   INNER JOIN machines AS c ON c.id = a.machine_id
   INNER JOIN hstatus AS d ON d.id = a.hstatus_id
   LIMIT r_start , r_retrieve;

END //

DELIMITER ;

This does not work, Stackoverflow said that the LIMIT clause doesn't take parameters only on new versions... How do I see my MySql version in my phpadmin?


  Session:transient error
Posted by: badger - 03-18-2017, 04:41 AM - Forum: Issues - Replies (7)

My new site using ci312, php 533 and mysql5083 has been running perfectly (thanks to ci developers for a great product) for over 3 months. However, about once a week (max) a session error occurs as shown below. I don't understand why it is happening. The table has the correct indices
PRIMARY KEY (`id`), UNIQUE INDEX `ci_sessions_id_ip` (`id`, `ip_address`), INDEX `ci_sessions_timestamp` (`timestamp`).
Apart from this there are no other log entries. Any suggestions?
Many thanks,
Bill

ERROR - 03-17 22:08:44 --> Query error: Duplicate entry 'd5c0884d53d8ddd3d0a077ab6f7827491619506a' for key 1 - Invalid query: INSERT INTO `ci_sessions` (`id`, `ip_address`, `timestamp`, `data`) VALUES ('d5c0884d53d8ddd3d0a077ab6f7827491619506a', '93.107.38.150', 1489788524, '__ci_last_regenerate|i:1489788521;|a:2:{i:0;s:1:\"2\";i:1;s:4:\"2/40\";}pretrolley_page|s:4:\"2413\";previous_page|s:4:\"2413\";')
ERROR - 03-17 22:08:44 --> Severity: Warning --> Unknown: Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/usr/local/pem/vhosts/141487/tmp/) Unknown 0


  CI_Validation has a deprecated constructor
Posted by: cperrot - 03-18-2017, 12:53 AM - Forum: General Help - Replies (4)

Which version of CI will be ready for PHP7.x?

I am currently running 3.1.3 and some web-hoster just won't let you use error_reporting = ~E_DEPRECATED & ~E_NOTICE & E_ALL
to be able to get rid of these deprecated messages.

Regards

Cedric



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