What is MariaDB? A comparison with MySQL

Performance The biggest feature and therefore the biggest advantage of MariaDB is its speed and performance. When it comes to performing queries or replication, MariaDB is faster than MySQL. So if you need a high-performance relational database solution, MariaDB is a good choice. In addition, MariaDB also easily supports a high concurrent number of connections … Read more

How to create Pagination with PHP and MySQL

<html> <head> <title>Pagination</title> <!– Bootstrap CDN –> <link rel=”stylesheet” href=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css”> <script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js”></script> <script src=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js”></script> </head> <body> <?php if (isset($_GET[‘pageno’])) { $pageno = $_GET[‘pageno’]; } else { $pageno = 1; } $no_of_records_per_page = 10; $offset = ($pageno-1) * $no_of_records_per_page; $conn=mysqli_connect(“localhost”,”my_user”,”my_password”,”my_db”); // Check connection if (mysqli_connect_errno()){ echo “Failed to connect to MySQL: ” . mysqli_connect_error(); die(); } … Read more

MySQL LIMIT & OFFSET with Examples

Using the OFF SET in the LIMIT query The OFF SET value is also most often used together with the LIMIT keyword. The OFF SET value allows us to specify which row to start from retrieving data Let’s suppose that we want to get a limited number of members starting from the middle of the rows, we … Read more

How to convert MySQL data to JSON using PHP

<?php // Initialize variable for database credentials $dbhost = ‘hostname’; $dbuser = ‘username’; $dbpass = ‘password’; $dbname = ‘sakila’; //Create database connection $dblink = new mysqli($dbhost, $dbuser, $dbpass, $dbname); //Check connection was successful if ($dblink->connect_errno) { printf(“Failed to connect to database”); exit(); } //Fetch 3 rows from actor table $result = $dblink->query(“SELECT * FROM actor … Read more

How To Remove HTML Tags In PHP & MySQL – Simple Example

To remove HTML tags in PHP, we can either use the strip_tags() or htmlentities() function: The strip_tags() function will remove all HTML tags. For example, $clean = strip_tags(“<p>Foo</p> Bar”); will result in Foo Bar. The htmlentities() function will not remove but convert all symbols into HTML entities. For example,  $clean = htmlentities(“<p>Foo</p>”); will result in &lt;p&gt;Foo&lt;/p&gt; Lastly, we can also create a stored function in MySQL to strip HTML … Read more

Create Simple RESTful API with PHP & MySQL

In this tutorial you will learn how Create Simple RESTful API with PHP and MySQL. We will implement REST API with CRUD operations to create items, read items, update items and delete items. We will cover this tutorial step by step with live example to create RESTful API to perform CRUD (Create, Read, Update, Delete) operations … Read more