Category Archives: Coding

All kinds of Programming.

How to Check System Load in Php on Linux

By | August 8, 2020

System load System load is a measure of how busy the system is running the processes. Higher system load simply means more processes are running and more are waiting to be run. When coding php applications, it sometimes is useful or necessary to find the current load on the server/system. For example if you want… Read More »

How to enable encoded forward slash in path-info in mvc or CodeIgniter app urls

By | May 16, 2023

Path Info Urls When using path info data , the urls of codeignitor apps or your custom mvc frameworks looks something like this example.com/index.php/controller/method/param1/param2 or example.com/controller/method/param1/param2 The path info data can be used to specify which class and method should be invoked on server application. Forward slash in parameter Sometimes it might so happen that… Read More »

How to use “path info” with PATH_INFO / ORIG_PATH_INFO in Apache Php Setup

By | May 15, 2023

The PATH-INFO is the extra path data that follows the name of a script (or servlet) in the URL. Its different from query string. Here is a classic example: https://www.examples.com/index.php/some/path?a=b Now, over here we are actually invoking the script index.php only. However also providing some path-info data “/some/path”, which is then followed by the query… Read More »

How to List foreign keys in Mysql

By | November 14, 2023

information_schema The following query will list out the foreign keys in mysql. It finds it out from the information_schema database. select concat(table_name, '.', column_name) as 'foreign key', concat(referenced_table_name, '.', referenced_column_name) as 'references' from information_schema.key_column_usage where referenced_table_name is not null; The output is a clean table listing out all foreign keys from all databases +———————–+————-+ |… Read More »

Create foreign key using Phpmyadmin

By | May 9, 2020

The innodb storage engine supports foreign keys in Mysql. To create foreign keys in phpmyadmin : 1. Convert both tables into innodb, if they are not already. 2. View the structure of the table which will have a foreign key. Make the referencing field an INDEX. 3. Now come back to structure view and click… Read More »

Create AutoIncrement column/field in Apache Derby

By | July 6, 2009

While creating a table a particular column / field can be made autoincrement as : CREATE TABLE students ( id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), name VARCHAR(24) NOT NULL, address VARCHAR(1024), CONSTRAINT primary_key PRIMARY KEY (id) ) ; The value of an autoincrement column increments automatically with… Read More »

PHP redirect – go back to previous page

By | September 1, 2023

To go back to the previous page the superglobal variable $_SERVER can be used. $_SERVER[‘HTTP_REFERER’] has the link to the previous page. So to redirect simply : // Method to go to previous page function goback() { header("Location: {$_SERVER['HTTP_REFERER']}"); exit; } goback();