October 1, 2016

JavaScript localstorage with good example



In javascript using localstorage you can simply save any single OR array value same like work as a PHP session.


There is a simple solution though, and that’s to use local storage.

The good news is to stored any data to computer so when page reload then you can get data back from localstorage.


WHAT IS EXACT MEANING OF LOCAL STORAGE?

  • Local Storage: stores data with no expiration date and this is the one we will be using because we want our to-do’s to stay on the page for as long as possible.
  • Session Storage: only saves the data for one session so if the user closes the tab and reopens it all their data will be gone.

BELOW ARE SOME EXAMPLE FOR SET VALUE, GET VALUE AND CLEAR VALUE FROM LOCAL STORAGE

To set item into local storage:

localStorage.setItem('username', 'admin');

To get value from local storage:
localStorage.getItem('username');
Output: admin

To clear any value from local storage:
localStorage.removeItem('username');


Enjoy!





September 5, 2016

PHP - MariaDB database connection.



Hello everyone, this this simple way to connect MariaDB with PHP,

Here I explain with simple example.

Example:

<?php
$connection=mysqli_connect("hostname","username","password");
$db = mysqli_select_db("databasename");
if (mysqli_connect_errno())
{
echo "Connection Failed with MariaDB:" . mysqli_connect_error();
}
?>

Enjoy!


September 4, 2016

MySQL select query to inner join two table in single field.




MySQL select Query to inner joint two tables on single field.

SELECT CASE

WHEN STATUS_FLAG=1 THEN (select id from table2 where id=TABLE1.F_ID)

ELSE (select id from table3 where id=TABLE1.F_ID)

END


FROM TABLE1

MySQL select query with case and when condition.



Here I explain CASE and WHEN condition with MySQL select query.

MySQL Example:

SELECT CASE

          WHEN STATUS_FLAG=1 THEN ‘Yes’ ELSE ‘No’

           END AS STATUS_FLAG


FROM TABLE1


Enjoy!

August 1, 2016

PHP - Call to undefined method PDF_HTML::FPDF()..



Before one day I realize this error and I find a simple solution, See below:

On included file 'html2pdf.php' you should just rename one function name as per below:

Approx line no: 52

1. Line no: 49
Replace function PDF_HTML with function __construct

2. Line no 52
Replace $this->FPDF with parent::__construct

Enjoy!

The Future of Technology: Emerging Trends to Watch in 2025

Introduction As we navigate through 2025, the technological landscape continues to evolve at an unprecedented pace. Innovations that once se...