Tag Archives: codeigniter

Data saved twice when it contains “select” word using CodeIgniter + PDO + SQL Server

Questions: I have a CodeIgniter application and SQL Server database. I’m using PDO as a driver, everything works fine, but not when I’m trying to save data that contains the words “select” or “selection”. Example: $data = array(); $data[] = array(‘title’ => ‘all you neeed’, ‘description’ => ‘description here’); $data[] = array(‘title’ => ‘try this… Read More »

You have specified an invalid database connection group codeigniter error

Questions: i’m making a CRUD from a tutorial. And i’m getting this error. You have specified an invalid database connection group. What would be the problem? database.php – database config $db[‘default’][‘hostname’] = ‘localhost’; $db[‘default’][‘username’] = ‘root’; $db[‘default’][‘password’] = ”; $db[‘default’][‘database’] = ‘cicrud’; $db[‘default’][‘dbdriver’] = ‘mysql’; $db[‘default’][‘dbprefix’] = ”; $db[‘default’][‘pconnect’] = TRUE; $db[‘default’][‘db_debug’] = TRUE; $db[‘default’][‘cache_on’]… Read More »

CodeIgniter multi-application .htaccess problem

Questions: I have a problem with CodeIgniter .htaccess file and hope that somebody can help me! I don’t know regular expressions or how to use the .htaccess, I’m very new with this things! My Problem is: I have this structure of files (multi application): – application – admin – site – system – index.php -… Read More »

How to JOIN three tables in Codeigniter

Questions: I’m using codeigniter framework to develop one music cms. i have 3 tables in mysql database, Currently im working in “Album” Table and “Model, Controller”. i want to SELECT “Album” Table 1 and JOIN “Album” -> “cat_id” with “Category” -> “cat_id”, and fetch all categories records. Then i want to JOIN “Album” -> “album_id”… Read More »

How to create Codeigniter language files from database?

Questions: I’m building a multi-language online site with Codeigniter. My question is how to pass data from database to the Codeigniter language files. My logic so far is to run a foreach query, which will populate the language file with translation_key and value. The Problem is that language files aren’t some extended CI_class classes and… Read More »

Codeigniter ActiveRecord: join backticking

Questions: I’ve a simple question: how can I use CodeIgniter’s ActiveRecord join function? I want this: LEFT JOIN cimke ON (mk_terem.id_kicsoda=5 AND mk_terem.id_target=cimke.id_cimke) LEFT JOIN tanar ON (mk_terem.id_kicsoda=1 AND mk_terem.id_target=tanar.id_tanar) But if I use $this->db->join(cimke,”mk_terem.id_kicsoda=5 AND mk_terem.id_target=cimke.id_cimke”), the value 5 will be between backticks. How can I do this? UPDATE What I want? If mk_terem.id_kicsoda… Read More »

Codeigniter's regex match

Questions: I have this regular expression for validation in javascript: /^(?:'[A-z](([\._\-][A-z0-9])|[A-z0-9])*[a-z0-9_]*’)$/ Now I want the same regular expression for the form validation using Codeigniter’s form validation: $this->form_validation->set_rules(‘username’, ‘Nombre de usuario’, ‘required|min_length[2]|max_length[15]|regex_match[/^[A-Z a-z 0-9 _ . \-]+$/]|is_unique[user.username]’); the regex in that line is not equivalent to the one I mentioned. When trying to copy and paste… Read More »