codeigniter : Commands out of sync; you can’t run this command now

add following code into /system/database/drivers/mysqli/mysqli_result.php function next_result() { if (is_object($this->conn_id)) { return mysqli_next_result($this->conn_id); } } then in model when you call Stored Procedure $query = $this->db->query(“CALL test()”); $res = $query->result(); //add this two line $query->next_result(); $query->free_result(); //end of new code return $res;

codeigniter table join

users table was in both from and join functions, so in sum you were joining 3 tables: users, users and users_profiles -> the 2 first have the same name -> error unique/alias table. Try this (joining [users in from] on [users_profiles in join]): $this->db->select(‘users.usrID, users_profiles.usrpID’) ->from(‘users’) ->join(‘users_profiles’, ‘users.usrID = users_profiles.usrpID’); $result = $this->db->get(); EDIT: example: … Read more

how to validate array value in codeigniter

It doesn’t let me submit the form If so, It sounds like a bug. Temporarily, you can check whether duration[] array is empty or not: if (! empty($_POST[‘duration’])) { $this->form_validation->set_rules(‘duration[]’,”Duration”, “trim|xss_clean|numeric”); } I’ll update my answer if I found the main solution. Update: This is a bug as I expected, I opened a PR at … Read more

Upstream too big – nginx + codeigniter

Add this to your http {} of the nginx.conf file normally located at /etc/nginx/nginx.conf: proxy_buffer_size 128k; proxy_buffers 4 256k; proxy_busy_buffers_size 256k; Then add this to your php location block, this will be located in your vhost file look for the block that begins with location ~ .php$ { fastcgi_buffer_size 128k; fastcgi_buffers 4 256k; fastcgi_busy_buffers_size 256k;

Where do I put image files, css, js, etc. in Codeigniter?

I have a setup like this: application system assets js imgs css I then have a helper function that simply returns the full path to this depending on my setup, something similar to: application/helpers/utility_helper.php: function asset_url(){ return base_url().’assets/’; } I will usually keep common routines similar to this in the same file and autoload it … Read more

How to integrate codeIgniter with netbeans fully

If you just want auto-complete of functions then this will do it for you. 1) Create a folder in Netbeans called ‘autocomplete‘ in ‘Source Files‘ 2) Create two files in here called something like ci_code_completion_controllers.php and ci_code_completion_models.php Add this into each file; <?php /** ********* CONTROLLERS ********* * @property CI_DB_active_record $db * @property CI_DB_forge $dbforge … Read more

PostgreSQL next value of the sequences?

RETURNING That’s possible with a single round-trip to the database: INSERT INTO tbl(filename) VALUES (‘my_filename’) RETURNING tbl_id; tbl_id would typically be a serial or IDENTITY (Postgres 10 or later) column. More in the manual. Explicitly fetch value If filename needs to include tbl_id (redundantly), you can still use a single query. Use lastval() or the … Read more