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

Codeigniter: does $this->db->last_query(); execute a query?

The query execution happens on all get methods like $this->db->get(‘table_name’); $this->db->get_where(‘table_name’,$array); While last_query contains the last query which was run $this->db->last_query(); If you want to get query string without execution you will have to do this. Go to system/database/DB_active_rec.php Remove public or protected keyword from these functions public function _compile_select($select_override = FALSE) public function _reset_select() … Read more

How do I run CodeIgniter migrations?

Using these pages as references: Running via the CLI and Migration Class you’re able to restrict access to your migration controller to command line with something along these lines (application/controllers/migrate.php): <?php if ( ! defined(‘BASEPATH’)) exit(“No direct script access allowed”); class Migrate extends CI_Controller { public function __construct() { parent::__construct(); $this->input->is_cli_request() or exit(“Execute via command … Read more

Does CodeIgniter automatically prevent SQL injection?

CodeIgniter DOES ESCAPE the variables you pass by when using the $this->db->query method. But ONLY when you pass the variables as binds, here’s an example: $dbResult = $this->db->query(“SELECT * FROM users WHERE username = ?”, array($this->input->post(‘username’))); Also remember that $_POST shouldn’t be preferred over $this->input->post since what it does is check if the variables exists … 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;

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)