Questions tagged [codeigniter]

18920 questions
1

votes
1

answer
539

Views

403 Forbidden error using ajax in CodeIgniter

I am displaying the first name in my textbox autocomplete using ajax but my ajax URL is not working. It's every time showing in the network tab 403 Forbidden. I tried ajax URL like this url:baseUrl + '/index.php/Employee_control/search_with_emp_name', url:baseUrl +'/Employee_control/search_with_emp...
user9437856
1

votes
3

answer
36

Views

Issue in adding $my_elements inside the array

My aim is to reduce the elements which matches the numbers from one array to another. $my_elements = '329,330,331,332,333,334,335,336,337,338,339,340'; $my_array =array(329,330,331,332,333,334,335,336,337,338,339,340,341,342,359); $to_remove = array($my_elements); $result = array_diff($my_array,$t...
Raza Barlas Mills
0

votes
0

answer
13

Views

Codeigniter page routing issue

I'm trying to link pages in codeigniter in order to build a simple template, however, I followed some tutorials on the web, but it's not working as I expected. The 'About' page shows 404 where I want to show the about.php in the view folder. Please help me sort out this problem Controller - Cpages....
user3766509
1

votes
4

answer
27

Views

How to display html month tag input already saved in sql in format Month, year?

I have used html input month tag to take a calender entry as was required by client, it was saved as text in sqldatabase table, its in format 2019-03 where as I need it in March-2019 format.. I have used date_format(), date(), strtotime() but its of no use because the input tag is not completely in...
Numan
1

votes
3

answer
650

Views

Modifying items in a $_POST array

I'm using CodeIgniter to validate form data, and then posting it to a third party site using the php header() function with the $_POST key-value pairs as URL parameters. So for example: 'first_name' => 'chris' 'area_code' => '555' 'phone_number => '555-5555' ... would become 'http://thirdpartysite.c...
Chris
1

votes
2

answer
67

Views

How do I put the php variable into css [duplicate]

This question already has an answer here: What is the difference between single-quoted and double-quoted strings in PHP? 10 answers I would like to have a dynamic style color base on the database // the first line is static $row_color = $value['late'] >= 60 ? ' style='color:red;'' : '';$ // and thi...
NOOB
2

votes
1

answer
20

Views

Can't filter the data as category wise in codeigniter

I am developing an online shop, where I want to display category wise data. But I can't! I pass the URL like below http://localhost/e-bookshop/users/all_books?ctg=1 My Model: public function get_books() { $this->db->select('*'); $this->db->from('category'); $this->db->join('books', 'books.categoryId...
tumn
1

votes
1

answer
10

Views

How to validate an empty checkbox and display message via AJAX using CodeIgniter form validation library?

Displaying form error message when checkbox is not checked using CodeIgniter form validation library. Currently, form error message is displayed only when checkbox is checked. Here is AJAX call: $('#add_user').on('submit', function(e) { e.preventDefault(); $.ajax({ url : $(this).attr('action'), meth...
Boba_Fett
1

votes
0

answer
249

Views

Krajee's file input only upload last selected image

I'm working with this plugin in Codeigniter as I want to upload multiple files (either it can be multiple images, videos or files) and as mentioned there I have done the following code HTML Script $('#attachment').fileinput({ uploadUrl: '#', uploadAsync: false, showCaption: false, fileActionSettings...
Mr. Pyramid
1

votes
1

answer
109

Views

CodeIgniter - Update Database Record

I've done the coding of Update Database record in Codeigniter. Everything works fine but When I click the Save button database records won't update. Each time it's showing the old database records. I want to update the database records but what's wrong with this. I don't understand the missing thing...
Mehreen
1

votes
0

answer
253

Views

MySQL connection issue in gcloud

I have deployed codeigniter project in google cloud app engine . I am getting database connection problem. Database connection is below - $db['default'] = array( 'dsn' => 'mysql:unix_socket=/cloudsql/tastyeater-190406:us-central1:tastyeater;dbname= databasename', 'hostname' => 'localhost', 'username...
Farman Ali Khan
1

votes
1

answer
1.8k

Views

How to generate pdf using Codeigniter?

I have tried using dompdf. The following is controller in the Codeigniter function get_pdf( ) { $this->load->library('Pdf'); $this->pdf->load_view('report.php' ); $this->pdf->load_html('report.php','',true); $this->pdf->render(); $this->pdf->stream('welcome.pdf'); } The data in report.php $(documen...
Akhil Sahu
1

votes
1

answer
50

Views

Can't pass data from view to controller

I have a strange problem. I can't pass the data from form to controller. I think my code was right, but I don't know why it can't pass the data- and always says 'failed'. I've tried to print the data that I post, but it says 'no data'. Maybe there is something I forgot to do, and can you help me? He...
kitcat
1

votes
0

answer
412

Views

FFMPEG- How to generate thumbnail from video in Codeigniter

I'm working on generating thumbnail from uploaded video in Codeigniter for this I'm using ffmpeg but when I'm trying to generate the thumbnail I'm getting this error ffmpeg: symbol lookup error: /usr/lib/x86_64-linux-gnu/libass.so.5: undefined symbol: FT_Outline_EmboldenXY I've already installed ffm...
Mr. Pyramid
1

votes
2

answer
59

Views

User defined variable not working in Mysql Code Igniter

I am trying to rank the rows based on when was it lasted updated partitioned by category name. $query = 'SELECT category_name, topic_title, updated_ts, @topic_rank := IF(@current_category = category_name, @topic_rank + 1, 1) AS topic_rank, @current_category := category_name AS current_category F...
Ganesh T
1

votes
1

answer
74

Views

Codeigniter check existance of file returns null

I've to upload a video in my project page.Code in View, Code in Controller, $videoid=0; if(isset($_FILES['video_file']['size']) && $_FILES['video_file']['size'] > 0) { $this->load->library('upload'); // Upload image $this->upload->initialize(array( 'upload_path' => $this->settings->info->upload_pat...
usertest
1

votes
1

answer
57

Views

Update two table or more Codeigniter

I'm trying to update 2 tables frm_data_aset and frm_monitor at the same form. in frm_data_aset have column lokasi_aset and in frm_monitor have column lokasi_monitor, I want Both columns insert same value. When I try to run this I enter code here I'm getting an error : Severity: Notice Message: Unde...
Adie
1

votes
2

answer
137

Views

How to make user choose one item in invoice and don't choose the same item again in codeigniter

I'm making Invoice page and the user selects his/her item from drop list menu but the problem the user can select the same product in each drop list, I want if he selects a product from any drop menu can't choose it again. This is my view Invoice Success! Warning! Customer Details
Syam
1

votes
0

answer
25

Views

Refactor validation rules generating function

I need assistance with refactoring a function (the function is long and can be parted out later). I have a fields object that contains every column in a database table and has some additional information on the column such as the max_length and whether or not it can be null. These parameters form th...
Alex
1

votes
0

answer
34

Views

error: result_array() on boolean with sqlsrv ajax method

I am using Microsoft SQL Server Management Studio 2014, and I already configured everything on CI, I dont know why is this happening but it really did bother me alot. I got a stored procedure and that is what I will use in, for example my stored procedure is: create procedure [dbo].[set_add_user_i]...
SCrub
1

votes
0

answer
32

Views

I can't control dropdown list with codeigniter and ajax

Dropdown list can't control in second field. I don't sure what's wrong. My tables contain: Table 1: car (brand_id , car_brand) Table 2: model (model_id , brand_id , car_model) This my code on Controller. This my code on View. Brand
IamOnt
1

votes
0

answer
55

Views

check SQL syntax - The same model code is working for another db in Codeigniter model function

I am getting the following error, with the code below i am not getting any error on another db, but getting error on the first one, no clue whats happening, i am using codeigniter 1x and ver 10.1.25-MariaDB A Database Error Occurred Error Number: 1064 You have an error in your SQL syntax; check the...
sunshine
1

votes
3

answer
48

Views

Codeigniter combined AND OR condition not working [duplicate]

This question already has an answer here: CodeIgniter Active Record multiple “where” and “or” statements 2 answers Codeigniter: $this->db->select('item.*'); $this->db->from('items'); $this->db->where_not_in('item.ID', $Not); $this->db->where_in('item_sub_category.Sub_category', $Sub_categor...
Shah Rushabh
1

votes
0

answer
108

Views

Get child array information with Codeigniter Template Parser

I'm using the CodeIgniter3 Template Parser to avoid to have much PHP in my Views. Now I'm in trouble because i usually pass a 'big' Array to the Parser with some subArrays (that allows me to catalogate the informations) like this: $vars['userdata'] = $CI->session->all_userdata(); $vars['gameslist']...
Mattia Del Franco
1

votes
1

answer
39

Views

i want to pick last three days data from my database tables in codeigniter (msql)

i have there tables in my database and i want to pick last three days of data from my 3 different database tables and i also want to show if the data is same then it will show result otherwise show empty rows in codeigniter. my all there tables look like this ==> id temp hum rain time 1 16...
rana abdul wajid
1

votes
0

answer
72

Views

Preflight response won't accept my header params

I have written a REST API using CodeIgniter 3.0. I am trying to make calls to this API using Angular 2.0 Http module inside of a service. Anytime I include a header parameter in the request, this error is thrown. Request header field apikey is not allowed by Access-Control-Allow-Headers in prefligh...
Alim Charaniya
1

votes
0

answer
86

Views

Get the values of selected item from select box and display it on label and table codeigniter

Hi I've been searching for this answer but I still got errors. I want to display the details of product based on selected item on select box that uses select2, the items or values of select box is from the database. View
maine shar
1

votes
2

answer
59

Views

Codeigniter uploading an image to a path folder but in the no record in the database

I need some help, I can upload an image to a folder path but in the database there is no record that i insert an image... Here's my code ----Controller Code---- public function insert_product() { $this->form_validation->set_rules('product_name','Productname','required'); $this->form_validation->set...
Dave
1

votes
0

answer
251

Views

Codeigniter REST. How to properly protect against csrf

I am using the REST server by Phil Sturgeon and I was wondering how I can do CSRF Protection properly? Currently I am using this method: if(stripos($_SERVER['REQUEST_URI'],'API')!=''){ $config['csrf_protection'] = FALSE; }else{ $config['csrf_protection'] = TRUE;} However, I have read that this is n...
JianYA
1

votes
0

answer
34

Views

xml file does not download to heroku folder

I have a simple function that gets a 'Blob' file from the database and tries to download it to heroku 'collections' folder. It is working in my local computer where it takes the blob file and downloads it to my local directory but the same method does not work in Heroku. public function downloadColl...
Masnad Nihit
1

votes
0

answer
166

Views

Codeigniter rest server enable keys for login process

I am using chriskacerguis Rest Server as my backend processor and have recently enabled $config['rest_enable_keys'] = TRUE; I created the required table and managed to generate api keys for each user. However, I discovered that I can only use this when a user is already logged in. If they are not,...
JianYA
1

votes
1

answer
27

Views

403 error on installed codeigniter on godaddy subdomain

I have a Wordpress on a main domain which works fine but just installed CodeIgniter 3 on a subdomain and I keep getting Additionally, a 403 Forbidden error on CodeIgniter. I have played around with .htaccess with no success. Here is my .htaccess as it now RewriteEngine On #RewriteBase / RewriteCond...
user2560659
1

votes
1

answer
40

Views

Codeigniter 3: update Sql table column via GET superglobal

I am working on a Register and Login application with CodeIgniter 3 and Bootstrap. In my 'users' table I have an 'active' column that can take either 0 or 1 as value. I want to be able to change the value of the 'active' column corresponding to a user from 0 to 1 (activate the user) by clicking a li...
Razvan Zamfir
1

votes
1

answer
115

Views

Codeigniter CLI does not log

I have the following function which updates the status of my vacancies (based on dates) and logs the amount of vacancies that got a change, it looks like this: //Function used to check the statusses of every vacancy and update it accordingly function checkVacanciesStatusses() { // this function can...
Dennis
1

votes
1

answer
39

Views

Codeigniter defining variable in controller vs passing to model

I'm wondering which method is better from a best practices perspective: Option 1: Controller: $this->data['my_var'] = 'some value'; $response = $this->My_model->some_method(); Model: function some_method() { $var = $this->data['my_var']; //do stuff } Option 2: Controller: $this->data['my_var'] = 's...
hyphen
1

votes
1

answer
81

Views

Is shared services right way to implement DRY in angular 2?

I am looking for implementing ERP frontend in angular 2. I have my exisiting implementation in codeigniter HMVC structure.From which I have converted all models/controllers calls in to REST APIS. The older structure was reusing lots of view component for CRUD operations in modules such as CRM, Acco...
jaydeep marvaniya
1

votes
0

answer
195

Views

codeIgniter 3 redirect host domain to index [duplicate]

This question already has an answer here: Set up the base url in codeigniter 3 answers CodeIgniter removing index.php from url 29 answers I am trying to redirect my domain.com to domain.com/index. I tried both via route.php and httaccess. but not working. route.php $route[''] = 'front_controllers/...
1

votes
2

answer
443

Views

json_encode codeigniter pass array to view

I would like to pass a json encoded array to the view in codeigniter public function test() { $arr = array( 'first_name' => 'Darian', 'last_name' => 'Brown', 'age' => '28', 'email' => '[email protected]' ); echo json_encode($arr); } The ajax request in the view: $.ajax({ type: 'POST', url: 'test'...
de albuquerque frank
1

votes
0

answer
312

Views

CodeIgniter 2.x to 3.1.7 all controllers redirecting to default controller

I've recently upgraded a project from CodeIgniter 2.x to 3.1.7 but I'm having some issues. There's a ton of similar questions been asked before but none of them solve the issue I'm having. Basically all of my controllers are redirecting to the default controller. So visiting mywebsite.com shows the...
thequestioner
1

votes
1

answer
125

Views

Instead of generating PDF, it displays the HTML page on the browser

I am generating a pdf using mpdf. It actually converts a HTML file into pdf. The HTML file gets filled up by some data. The codes in the controller are : $pdfFilePath = APPPATH.'invoice/firstinvoice1901.pdf'; //load mPDF library $this->load->library('m_pdf'); $html = $this->load->view('admin/paymen...
Shantanu

View additional questions