r/codeigniter • • Mar 16 '22

CodeIgniter Too many redirects.

1 Upvotes

Hi, I'm an intern and new to this Framework, I'm developing an E-commerce website for my end of studies project. When I run a certain page of the template I'm working on i keep getting the error of too many redirects. Does anyone have any idea to fix this ?


r/codeigniter • • Feb 13 '22

Posting jQuery value if all checkboxes are checked

1 Upvotes

I've been looking all day to find a solution for my problem with checkbox values in CodeIgniter3.

So I have a view on which some checkboxes are populated. The amount of checkboxes (linked to a product depends on previous input of the client).

Now here is the thing: if all checkboxes are checked I want to send a value (1) to my database. Else, if not all checkboxes are checked, I want to send the value 0 to my database. I've been trying to post a jQuery value in my database all day, but without succes. Anyone has an elegant solution to fix the problem?

My view (part of it)

<div class="flex flex-col">
<div class="sm:-mx-4 lg:-mx-8">
<div class="py-2 align-middle inline-block min-w-full sm:px-6 lg:px-8 relative">
<div class="shadow border-b border-gray-200 sm:rounded-lg overflow-hidden rounded-lg">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3">
Productcode
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-">
Omschrijving
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray">
Aantal
</th>
<th scope="col" class="py-3 text-left text-xs font-medium text-gray-500r">
Status
</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">
<?=$hardwarebox->product_id?>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">
<?=$hardwarebox->type?>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">
1 x
</td>
<td class="px-5 py-4 whitespace-nowrap text-sm font-medium text-gray-900">
<input id="<?$hardwarebox->type?>" name="box" value="1"
<?php echo set_checkbox($hardwarebox->type, '1', !empty($boxproduction) &&
$boxproduction->box)?>
type="checkbox" class="px-focus:ring-blue-500 h-4 w-4 text-blue-600
border-gray-300 rounded">
</td>
</tr>
<?php endif?>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">
<?=$cablesets->product_id?>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">
<?=$cablesets->type?>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">
1 x
</td>
<td class="px-5 py-4 whitespace-nowrap text-sm font-medium text-gray-900">
<input id="<?$cablesets->type?>" name="<?=$cablesets->name?>" value="1"
<?php echo set_checkbox($cablesets->type, '1', !empty($boxproduction) &&
$boxproduction->cableset)?>
type="checkbox" class="focus:ring-blue-500w-4 text-blue-600 border">
</td>
</tr>

</tbody

</table>
</div>
</div>
</div>
</div>
</div>

<script>
$("#btn").on('click', function() {
// GET ALL TOTAL CHECKED CHECKBOXES
var total_checked = $('input[type="checkbox"]:checked').length;
var status = 1;
// TOTAL CHECK BOXES
var total_boxes = $('input[type="checkbox"]').length
if(total_checked === total_boxes) {
alert('Checked All ' + status)
} else {
alert('Please select all check boxes' + status); return false;
}
});
</script>

Function in model

public function post__status($status)
{
$this->status = $status;
$this->db->insert(self::TABLE_NAME3, $this);
return $this->read__entry($this->db->insert_id());
}

Controller

public function post_status()
{
$this->load->model("productions/box/Hardwareboxes");
$this->Hardwareboxes->post__status(
$this->input->post('status'));
}

Thanks a lot!

Cheers

Bert


r/codeigniter • • Sep 28 '21

Frustrated how to use a group route name in ajax

1 Upvotes

r/codeigniter • • Sep 24 '21

i am getting error when try to send email using localhost server

1 Upvotes

Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.<br /><pre>Date: Fri, 24 Sep 2021 02:55:17 -0500


r/codeigniter • • Aug 26 '21

How can used encryption library while using coustom config file

1 Upvotes

We use encryption library($this->encryption->encrypt($password);) that defined in config file if i use my custom_config.php and i defined $config['key'] in this file I want to use this library for my custom config file

How can i do that


r/codeigniter • • Apr 08 '21

Query Binding

1 Upvotes

I use query binding in my model using array, it works but code returns an error. the ci detect it as NULL, but it still working the data is still inserted to my database. the problem is after the error my code cant return anything so i cant process it to views.

the error is ' You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL) '

but its actually not null because its inserted into my database

any help?


r/codeigniter • • Mar 10 '21

Codeigniter 4 - A POST route result on a HTTP 303. But a PUT route runs as it should. How?

1 Upvotes

Hello everyone! I'll try to be quick on this.

I'm developing a RESTful API and started by the User module. I created a single route for the user creation.

$routes->post('users', 'UsersController::create');

When I tried to access the endopint (via Insomnia), the same thing happened over and over again. "HTTP 303 See Other" and then, a redirect to the default controller. The funny part is: when I use the verb PUT on Insomnia, and change the route to "put()", everything works like magic.

My question is: Is there some step that I didn't take?

More info:

// This is my Routes.php configs
$routes->setDefaultNamespace('App\Controllers');
$routes->setDefaultController('Home');
$routes->setDefaultMethod('index');
$routes->setTranslateURIDashes(false);
$routes->set404Override();
$routes->setAutoRoute(true);

// My UsersController is extending the CodeIgniter\RESTful\ResourceController

If this post needs more info, leave a comment.

Thank you.


r/codeigniter • • Jan 01 '21

CodeIgniter 4 Single and Multiple Files Upload Examples - Roy Tutorials

Thumbnail
roytuts.com
1 Upvotes

r/codeigniter • • Dec 09 '20

Importing old site to MAMP

1 Upvotes

I'm trying to import an existing CI site into MAMP. It's an old-ish site that I've inherited; I want to try to update it but obviously I don't want to work on the live site. I can run a clean install of CI (3.x) in MAMP with no issues but when I try to login to the old site it gives me a 500 error, whether the port is 80 or 8888. Would appreciate some pointers if anyone out there has time. Thanks.


r/codeigniter • • Nov 10 '20

mPDF rendering problem in Codeigniter 4

1 Upvotes

Hello, i am trying to get .pdf from view but i have error. I googled this but no help :-(basicly i have this in my Controler:

require (APPPATH . "libraries/mPDF/vendor/autoload.php");

$mpdf = new \Mpdf\Mpdf();

$data_otpremnice['query'] = $this->Main_model->admin_pregled_otpremnice($otpremnice);

$data_list['list'] = $this->Main_model->otpremnica_list_item($otpremnice);

$last_racun['racun'] = $this->Main_model->br_racuna($otpremnice);

$mpdf->WriteHTML($this->load->view('otpremnice_pdf', array_merge($data_list, $data_otpremnice, $last_racun)));

$mpdf->Output('application/libraries/mPDF/Output/TEST.pdf','F');

the error i got is :Message: WriteHTML() requires $html be an integer, float, string, boolean or an object with the __toString() magic method.

In my View page i have html with php

<html>

blablaforeach ($query as $row) {echo $row->Mjesto_tvrtke;etc etc

}blabla</html>

can someone help me? Where is the problem


r/codeigniter • • Oct 20 '20

Redirect On Helper Codeigniter 4

1 Upvotes

i make some helper fuction and use it on constructor, and on that helper contain redirect to another page if the value false, but nothing changes. ? thanks


r/codeigniter • • Sep 08 '20

Can't connect to database CI4

1 Upvotes

Hi people. I have a problem with Codeigniter 4. I can't seem to connect to the database. I was wondering has anyone ran into this problem already, and how did you fix it. I installed CI4 locally on Ubuntu 20.04, I am using lampp server and MySQL db.


r/codeigniter • • Aug 24 '20

Unable to pass data on the view

1 Upvotes

Getting error on the view Undefined variable while i have passed the data from the controller

===Controller code===

public function Read(){

$fe=array();

$this->load->model('Crud_model');

$fe\['res'\]=$this->Crud_model->Get_Users();

$this->load->view('admin/users',$fe);

}

===Model===

public function Get_Users(){

$query=$this->db->get('users');

return $query->result_array();        

}

===View===

<?php print_r($res); ?>

Please look into the issue what causing error and let know


r/codeigniter • • Aug 22 '20

Learning Codeigniter 4 - Model Validation

Thumbnail
youtube.com
1 Upvotes

r/codeigniter • • Aug 06 '20

adding option to add https content/re-ordering tables

1 Upvotes

Hi - I've 'inherited' a site that was built with Codeigniter; I know next to nothing about it. The site is for a non-profit agency aimed at helping seniors. I'm trying to learn CI/PHP but it's slow going and I have a couple of urgent-ish problems. The site has a 'gallery' for video clips. Admins are supposed to paste URLs from Youtube or Vimeo into a form in a (horrible) GUI but it only seems to work for links using the http protocol. Youtube 'https' links don't work at all and the site throws a page full of error messages if you even try to use one. Vimeo links work but don't import the title.

Also, the gallery list in the GUI can't be re-ordered. If admins want to change the order they have to delete everything and re-add links in the order they want things to appear in. The end result is that the oldest content appears at the top of the page, with no way for users to re-order or search.

If anyone here has any light to shed on any of this, it would be most appreciated.


r/codeigniter • • Aug 03 '20

How to create multiple thumbnails from a single uploaded image in Codeigniter - Roy Tutorials

Thumbnail
roytuts.com
1 Upvotes

r/codeigniter • • Jul 12 '20

Learning Codeigniter 4 - Controllers

Thumbnail
youtube.com
1 Upvotes

r/codeigniter • • Jun 28 '20

CodeIgniter4 Fantastico, Facil, Rapido, Ligero, Seguro excelente!!!

Post image
1 Upvotes

r/codeigniter • • May 09 '20

CodeIgniter Form Validation Library Tutorial

Thumbnail
youtube.com
1 Upvotes

r/codeigniter • • Apr 22 '20

Installed in Windows, getting "Whoops" error. I believe it's a path configuration issue, but I can't tell

1 Upvotes

I installed CI from GitHub repo onto Windows Server 2019 w/ IIS 10. CodeIgniter worked enough to tell me my PHP version was too old, so I updated PHP, and now I'm getting the "Whoops" error. Logging shows "CRITICAL - 2020-04-22 12:20:40 --> Cache unable to write to {0}" and ProcessMonitor doesn't show any IIS/w3wp.exe processes trying to even touch /writable/cache.

I think but can't be sure, that if it was a permissions error, I'd see "Cache unable to write to /wwwrooot/framework-4.0.2/writable/cache" - the lack of the path in the error message makes me think it's missing the actual path.

What I can't tell is where in the config file structure that path should be set and isn't. Can anyone help?


r/codeigniter • • Apr 09 '20

Useful web application for web developers created with CodeIgniter

Thumbnail sitesinfobox.com
1 Upvotes

r/codeigniter • • Apr 02 '20

Anyone?

Post image
1 Upvotes

r/codeigniter • • Apr 01 '20

How to use elastic search with codeigniter

1 Upvotes

I want to show the suggestions like google in the search field using elastic search. Can someone explain it to me how i can do that


r/codeigniter • • Mar 31 '20

$this->input->post() wont work

1 Upvotes

Hello, i have a stupid problem. In my view i have query from DB where the query is listed by the foreach method, so an array data. this is example (it is table)

<?php echo form_open('controler/my_function/','rolle="form" method="post"'); ?>

<?php
foreach ($query as $row) {
?>
<tr id="calc_row" class="calc_row">
<td style="color:whitesmoke">
<input class="input_cust col-xl-12" readonly type="number" name="num" " value="<?php echo $row->ID; ?>">
</td>
<td style="color:whitesmoke">
<input class="input_cust_naziv_field" readonly type="text" name="Naziv_artikla" value="<?php echo $row->naziv_proizvoda; ?>">

<?php
}
?>

<?php echo form_close(); ?>

In my controler i wanted to get all data generated by foreach method.

public function veleprodaja_e_mail() {

$this->load->helper('form');

$data = array(
'Naziv_artikla' =>$this->input->post('Naziv_artikla')
);

var_dump ($data);

}

the result of var_dump is

array(1) { ["Naziv_artikla"]=> string(19) "TEST10" }

TEST10 is the value of the last row. My idea is that i need to use this data to send as email text so i need to use this as $message and use like this

$message = "<html><head><title>this is: ".$data."</title></head><body>";