codeigniter

codeigniter acsess data with query

痴心易碎 提交于 2019-12-25 02:42:42
问题 I have an error in my project, can you please help me? Here's my code : $q_cek_login = $this->db->get_where('tbl_karyawan', array('username' => $u, 'password' => $p)); if(count($q_cek_login->result())>0) { foreach($q_cek_login->result() as $qck) { if($qck->id_jabatan==1) { foreach($q_cek_login->result() as $qad) { $sess_data['logged_in'] = 'yesGetMeLogin'; $sess_data['username'] = $qad->username; $sess_data['nama_pengguna'] = $qad->nama; $sess_data['id_jabatan'] = $qad->id_jabatan; $this-

Smarty Templates with Codeigniter, Cant Load Template when too many directories in hirarichy

微笑、不失礼 提交于 2019-12-25 02:38:47
问题 I'm using CI Smarty https://github.com/Vheissu/Ci-Smarty There are Two issues with this as far as i have noticed. but the issue for which I opened this question is that I cant load a .tpl file if that .tpl file is inside the directory of another directory. e-g this is my current directory structure for SmartyTemplate --Themes --SomeOtherThemeName --Default //Default Theme Directory i am currently using --css --js --images --views --admin (directory) --sitesettings (directory) --site-settings

How can I get CodeIgniter 2.1.4 to load my extended Controller Class?

你离开我真会死。 提交于 2019-12-25 02:33:06
问题 I have looked for this answer all through stackoverflow and none have been able to help me. my file name is: application/core/MY_Controller.php class MY_Controller extends CI_Controller { /** * Constructor */ public function __construct() { parent::__construct(); } } I made a post in this thread asking if anyone had found an answer. I tried everything in that thread, and in all suggested links. I'm at a complete loss. Everything works on my local WAMP server (apache 2.4 php 5.4) and not on

Forcing an ANSI encoding on string (CP1252, ISO8859), obtaining UTF-8 encoding when force download it

给你一囗甜甜゛ 提交于 2019-12-25 02:29:04
问题 If I cast this on my starting string: echo mb_detect_encoding($string); I get the value: ASCII This string will be downloaded. I suppose it's UTF-8, as that's the default encoding for PHP as well as from the database. Its file extension will be .DAT, and I have already added it to config/mimes.php this way: 'DAT' => 'text/plain; charset=ISO-8859-1' Then if I try to download that string, using the download helper of Codeigniter (assume I have already loaded the helper) force_download('MYFILE

codeigniter - controller load multiple views

核能气质少年 提交于 2019-12-25 02:22:43
问题 I made a website but in two versions one for normal users and one for the mobile users and for both I made view page and also with multilanguage options, first I add in controller public function index() { if ($this->input->get("lang") =="en") $this->load->view('en_signup'); else $this->load->view('ar_signup'); $this->load->helper('url'); } } I made pages with name of marabic.php and menglish.php for mobile users now first I need to load these pages also but not mix with the original/default

destroying and creating session in the same function

ⅰ亾dé卋堺 提交于 2019-12-25 02:20:06
问题 in my logout function i like to destroy all session except one here is my function : public function out(){ $ref = $this->session->userdata('ref'); var_dump($ref); $this->session->sess_destroy(); $this->session->set_userdata('ref', $ref ); $ref = $this->session->userdata('ref'); echo '---------------------------------------<br />'; var_dump($ref); } but this doesnt work and it destroys all the session even ref and when i check ref in the next page i get null inn the function page i get this

how to view individual field of the table in codeigniter

喜夏-厌秋 提交于 2019-12-25 02:19:08
问题 I have created following table in mysql I want to retrieve one of the field i.e abstract or author or Title by using id dynamically in view field. These are my model, controller and view code. Model:This is my model $this->db->select("*"); $this->db->limit(10); $this->db->from("abcde"); $query = $this->db->query("SELECT * FROM abcde ORDER BY DocumentID ASC"); Controller: this is my controller here $this->load->model("Sample_model"); $data["fetch_data"] = $this->Sample_model->fetch_data();

Codeigniter mysql query with special characters

依然范特西╮ 提交于 2019-12-25 02:15:20
问题 Been struggling with this thing for hours now. Hopefully someone could help me out. Trying to get data from mysql based on first and last name. Everything works just fine except when there is special characters like ä or ö. I have the profiler on and query looks like this: SELECT mail, address, title FROM users WHERE firstname='teemu' AND lastname='sel%C3%A4nne' And it should be: SELECT mail, address, title FROM users WHERE firstname='teemu' AND lastname='selänne' In my model it's like this:

Invalid column name, column accents in MS SQL Server

前提是你 提交于 2019-12-25 02:13:01
问题 I'm currently working with an old database that has column names containing accents. When I try to execute this query in Codeigniter (PHP): SELECT * FROM [empresas] [em] LEFT JOIN [clientes] [cl] ON [em].[empresa] = [cl].[Código] The system throws the error "Invalid column name 'Código'". (the column name is 'Código') I've tried using COLLATE function with no success. The MS SQL Server database default collation is Modern_Spanish_CI_AI and the column collation is SQL_Latin1_General_CP1_CI_AS

What is the '_idx' suffix for on KEY for MySQL?

南笙酒味 提交于 2019-12-25 02:11:59
问题 Tried searching for this but couldn't find anything that helped me understand. In CodeIgniter's Session table creation query for example, there's a line: KEY `last_activity_idx` (`last_activity`) that comes after defining the column 'last_activity'. What's this for? 回答1: That means the column last_activity is indexed, and the name of the index is last_activity_idx . An index means that running conditional queries based on that field will be faster. For example, if you run a query like: SELECT