Sort MySQL Table Data in Ascending or Descending Order in CodeIgniter 4

In this tutorial I am going to show you how to sort MySQL table data in ascending or descending order to display them on HTML table on user interface (UI) using Codeigniter 4. I had also shown similar example using CodeIgniter 3. So when a user wants to see the data on UI either in ascending or descending order then the user needs to click on the table column header to sort the data on HTML table. I have created href link on the HTML table’s column header to make…

Continue

REST API CRUD Example in CodeIgniter 4 Framework

Here I am going to show you how to build REST web services in PHP based Codeigniter 4 framework. CodeIgniter 4 is the upcoming version of the framework and it is still under development, intended for use with PHP 7.2 or higher version. REST is an acronym that stands for Representational State Transfer (RESTful), which is an architectural style for distributed applications. PHP based CodeIgniter framework enables developers to develop the projects much faster, it provides the core part that can easily be extended or replaced completely to make the…

Continue

Google column chart using Codeigniter

We know that Google chart basically displays different statistical data on different chart types such as column chart, bar chart, line chart, pie chart etc. You can have a look at the URL https://developers.google.com/chart/ for more information. In my previous tutorial https://roytuts.com/google-chart-using-codeigniter/ the year value was always showing as 2k for 2010, 2011, 2012 etc. Now I have updated the code a little bit so that it will show the exact year on horizontal axis. You can integrate Google chart with any server side technology but here I will show you…

Continue

Codeigniter Join Example

Introduction In this tutorial I will show you CodeIgniter join example. I will use CodeIgniter’s Query Builder Class to build join queries for fetching data from multiple tables. The SQL Join clause is used to combine records together from two or more tables in a database. A Join locates related column values in two or more tables. This will display all the records that have matched.

Continue

Prevent SQL Injection in Codeigniter

Introduction This tutorial will show you how to prevent SQL injection in Codeigniter application. It is very important to escape the variable you pass to the database query because, in web application security, SQL injections play an important role. SQL injection is: a malicious code injection technique that may destroy your database. one of the most common web hacking techniques. the placement of malicious code in SQL statements, via input fields in web page. You usually use mysql_real_escape_string() function to prevent SQL injections, but you do not need to use…

Continue

File upload example in Codeigniter 2.1.4

File upload example in Codeigniter 2.1.4. There is file upload class, in codeigniter, which permits you to upload the file or files. This class also permits you to set various preferences such as destination where the file will be uploaded, restrition on file types, restriction on file size, whether a file name should be encrypted or not, maximum length of the file name etc. Below are the simple few processes for uploading a file A form with input type file is required so that user can select the file using…

Continue