codeigniter-3

Search encrypted data in Database

对着背影说爱祢 提交于 2019-12-11 13:52:50
问题 So I have encrypted records in my table and I would like to search these records. The problem is that when I do search and encrypt again my search term, it encrypts it again generating different, random string. Is there a way to encrypt data so that when encrypting again the same data it would produce the same string as at the first time of encrypting? Example: I'm using default settings for CI encryption library $data = "ABC"; $stored_data = $this->encryption->encrypt( $data ); $search =

The click event is working for all the view button at the same time

。_饼干妹妹 提交于 2019-12-11 12:12:26
问题 I am displaying the list of the records on the screen with buttons as showing on the image below. Now I am displaying the employee_id on the popup, So the admin will click on the view button and popup will display with the employee id. but my issue is, I am getting the all the employee list in the popup on click on view button. why this issue because I view button in the loop. <td><a href="javascript:void(0);" id="open_popup">View</a> and my script is here $(document).ready(function(){ $("a

Not able to insert path for multiple images in database table using codeigniter

徘徊边缘 提交于 2019-12-11 10:09:34
问题 I can't seem to figure out how to make this multiple image path upload working. I have been trying to fix it for 2 days but no luck. Problem: when form is submitted it uploads selected numbers of images to 'upload' folder but only inserts path for one image in db table. // Form Validation Goes Here } else { // Image upload starts here $number_of_files = count($_FILES['uploadedimages']['tmp_name']); $files = $_FILES['uploadedimages']; for($i=0;$i<$number_of_files;$i++) { if($_FILES[

CodeIgniter 3: Error Number 2014 Commands out of sync; you can't run this command now

拟墨画扇 提交于 2019-12-11 08:46:13
问题 I am receiving MySQL error number 2014 every time I call the 2nd stored procedure (insert_staff_logs) in CodeIgniter 3. Here is the complete error generated: A Database Error Occurred Error Number: 2014 Commands out of sync; you can't run this command now CALL insert_staff_logs('1000',now(),'LOGIN') Filename: C:/wamp/www/db2/system/database/DB_driver.php Line Number: 691 Here is my Model: class Login_model extends CI_Model { public function login($data) { $query = $this->db->query("CALL login

Is $this->session->userdata and $this->session->has_userdata same when use for authenticate in CodeIgniter?

雨燕双飞 提交于 2019-12-11 08:37:28
问题 I used use following code to authenticate in CodeIgniter. if(empty($this->session->userdata('user_id'))){ redirect(base_url()); } After reading the documentation again I found the Codeigniter has another function for it. if(!($this->session->has_userdata('user_id'))){ redirect(base_url()); } If both codes are same or my code has security issues? 回答1: Both are different functions & both of them have their own usage. The second is better option to use because it checks whether the user_data has

Remove url segment in codeigniter with .htaccess

梦想与她 提交于 2019-12-11 07:27:07
问题 I uploaded a Codeigniter project to /dev folder and the old url was http://example.com/dev . But now i moved the project to root folder. So the updated url is http://example.com . How can i redirect old url to new url by editing .htaccess file. Can i remove the url segment /dev/ from url like removing index.php i tried this method by adding the below code to .htaccess RewriteEngine on RewriteBase / RewriteRule ^/dev/(.+)$ /$1 [L,QSA] but didnt work 回答1: use this as .htaccess file

How to insert dynamic data in Codeigniter?

我怕爱的太早我们不能终老 提交于 2019-12-11 06:48:19
问题 I just want to insert dynamic generated input field data into database . My db table having three fields , id(Auto Increment), product_name and rate . I'm trying to insert bulk data into database using dynamically generated input fields where I can add/remove input fields manually. I created the input fields as <input class="form-control" placeholder="Product Name" name="prodname[]" type="text"> <input class="form-control" placeholder="Product Rate" name="prodrate[]" type="text"> This is my

html formatted emailing in codeigniter

一曲冷凌霜 提交于 2019-12-11 06:27:22
问题 how to send html formatted email in codeigniter i have this code which is sending email fine but it is not formatting it as it should look! you can see the picture which displays email received function email_sender() { // $this->load->helper('form'); // $this->load->helper('url'); $config = Array( 'protocol' => 'sendmail', 'smtp_host' => 'ssl://smtp.gmail.com', 'smtp_port' => '465', 'smtp_timeout' => '7', 'smtp_user' => '****@****.com', 'smtp_pass' => '*******', 'charset' =>'utf-8', 'newline

Callback function is not working - Codeigniter3 HMVC

强颜欢笑 提交于 2019-12-11 06:26:34
问题 m getting form validation error while using callback function in HMVC CI...i didn't understant the problme...my validation code is - $this->form_validation->set_rules('username', 'Email', 'trim|required|valid_email|callback_IsEmail_exist'); function IsEmail_exist() { $existing_email = $this->db->where("email", $this->input->post('username'))->get('tbl_user')->num_rows();//p($existing_email);echo $this->db->last_query();die; if ($existing_email != "0") { $this->form_validation->set_message(

MySQLi query too slow in loop

大兔子大兔子 提交于 2019-12-11 06:20:11
问题 Okk here's my code snippet foreach ($res->result() as $row) { $query = "SELECT count(*) AS count FROM (SELECT COUNT(DISTINCT TASKS.task_ID) AS count FROM TASKS JOIN TRANSLATOR_LANGUAGES JOIN PROJECT_USERS JOIN TRANSLATED_TASKS JOIN PROJECTS ON (TASKS.task_ID = TRANSLATED_TASKS.task_ID AND TASKS.project_ID = PROJECT_USERS.project_ID AND PROJECTS.project_ID = TASKS.project_ID AND TRANSLATED_TASKS.language_code = TRANSLATOR_LANGUAGES.language_code AND PROJECT_USERS.translator_ID = TRANSLATOR