phpMyAdmin

phpMyAdmin is an open-source software tool introduced on September 91998, which is written in PHP. Basically, it is a third-party tool to manage the tables and data inside the database. phpMyAdmin supports various type of operations on MariaDB and MySQL. The main purpose of phpMyAdmin is to handle the administration of MySQL over the web.

It is the most popular application for MySQL database management. We can create, update, drop, alter, delete, import, and export MySQL database tables by using this software. phpMyAdmin also supports a wide range of operation like managing databases, relations, tables, columns, indexes, permissions, and users, etc., on MySQL and MariaDB. These operations can be performed via user interface, while we still have the ability to execute any SQL statement.

phpMyAdmin is translated into 72 languages and also supports both RTL and LTR languages so that the wide range of people can easily use this software. We can run MySQL queries, repair, optimized, check tables, and also execute other database management commands. phpMyAdmin can also be used to perform administrative tasks such as database creation, query execution.

phpMyAdmin is a GUI-based application which is used to manage MySQL database. We can manually create database and table and execute the query on them. It provides a web-based interface and can run on any server. Since it is web-based, so we can access it from any computer.

Features of phpMyAdmin

phpMyAdmin supports several features that are given below:

  • phpMyAdmin can create, alter, browse, and drop databases, views, tables, columns, and indexes.
  • It can display multiple results sets through queries and stored procedures.
  • phpMyAdmin use stored procedure and queries to display multiple results sets.
  • It supports foreign keys and InnoDB tables.
  • phpMyAdmin can track the changes done on databases, views, and tables.
  • We can also create PDF graphics of our database layout.
  • phpMyAdmin can be exported into various formats such as XML, CSV, PDF, ISO/IEC 26300 – OpenDocument Text and Spreadsheet.
  • It supports mysqli, which is the improved MySQL extension.
  • phpMyAdmin can interact with 80 different languages.
  • phpMyAdmin can edit, execute, and bookmark any SQL-statements and even batch-queries.
  • By using a set of pre-defined functions, it can transform stored data into any format. For example – BLOB-data as image or download-link.
  • It provides the facility to backup the database into different forms.

Advantage of phpMyAdmin

  • phpMyAdmin can run on any server or any OS as it has a web browser.
  • We can easily create, delete, and edit the database and can manage all elements using the graphical interface of phpMyAdmin, which is much easier than MySQL command-line editor.
  • phpMyAdmin helps us to control the user’s permission and operate several servers at the same time.
  • We can also backup our database and export the data into different formats like XML, CSV, SQL, PDF, OpenDocument Text, Excel, Word, and Spreadsheet, etc.
  • We can execute complex SQL statements and queries, create and edit functions, triggers, and events using the graphical interface of phpMyAdmin.

Disadvantage of phpMyAdmin

  • phpMyAdmin is a simple interface, but quite tough for a beginner to learn.
  • phpMyAdmin is difficult to install as it needs three more software tools before installation, which is- Apache server, PHP, and MySQL.
  • We have to install all these software tools individually, whereas XAMPP already contains them in a single package. XAMPP is the easiest way to get phpMyAdmin.
  • It has no schema visualization.
  • phpMyAdmin is a web-based software tool which runs only on the browser, so It completely depends on browsers.
  • It does not have auto-compilation capability.

Data Backup problem with phpMyAdmin

phpMyAdmin lacks a lot of features in import/export functionality. There are some backup problems with phpMyAdmin that are given below:

  • Scheduling – There is no way to export the data of the database in phpMyAdmin automatically.
  • Storage media support – As we have discussed earlier, phpMyAdmin is web-based software, so it runs only on the browser. We can take backups only to local drives of our system.
  • Compression, Encryption, and other option – The files which are exported with phpMyAdmin are saved as common text files, with any additional processing. Whereas storing these files in the original form usually takes a lot of disk storage.

Prerequisite

  • Web server – Apache, Nginx, IIS
  • PHP
  • Database – MySQL, MariaDB
  • Web Browser

Web server – phpMyAdmin’s interface is based on our web browser, we need a web server to keep phpMyAdmin’s files inside it. Apache and IIS are popular web servers. We can download Apache web server from here http://mirrors.estointernet.in/apache//httpd/.

PHP – We also need to install PHP 5.3 or upper version to support different functionalities. It contains different extensions to provide support for these functionalities. For example –

  • Session support -SPL (Standard PHP Library) extension
  • Uploading of ZIP files support -PHP zip extension
  • Cookie authentication – mcrypt extension
  • Open Document Spreadsheet and XML importing support –libxml extension

We can download PHP from here. https://www.php.net/downloads.php.

Database – phpMyAdmin supports databases, i.e.

  • MySQL 5.5 or latest versions
  • MariaDB 5.5 or latest versions

Download the MySQL database from here https://dev.mysql.com/downloads/file/?id=486088 or MariaDB database from here https://mariadb.org/download/.

Web Browser – Web browser is required to access phpMyAdmin with enabled cookie and JavaScript. It can be Chrome, Internet Explorer, etc.

Difference between phpMyAdmin and MySQL Console

  1. phpMyAdmin provides a user interface through which we can execute query within SQL. We can also paste the query into SQL to test our output, whereas on MySQL Console we cannot copy and paste queries. We have to write query every time to execute on MySQL console.
  2. MySQL is a database server, on the other hand, phpMyAdmin is a server tool to access the database on MySQL server.
  3. We have to learn database query to create, delete, alter, update, and drop to execute on MySQL console, whereas in phpMyAdmin we can do it using graphical user interface which automatically executes these queries in background.

Note: In simple words, MySQL is a database, and phpMyAdmin is a software tool to access data from that database.

How to install phpMyAdmin?

Here we are going to discuss that how to download phpMyAdmin on Windows operating system. Below are the steps-

Step 1:

Download the latest version of phpMyAdmin software tool from here https://www.phpmyadmin.net/ as per the following instruction. Click on the download button to start downloading.

phpMyAdmin

Step 2:

A popup window will open. Click on Close button and move to the next step.

phpMyAdmin

Step 3:

Extract the downloaded file by right-clicking on the file and select Extract here, and rename the folder name with name phpmyadmin for easy access on the browser.

phpMyAdmin

Step 4:

Once all the files of phpMyAdmin extracted successfully, move the extracted folder of phpMyAdmin from downloaded location to C:\Apache\htdocs. We can also extract files directly in the htdocs folder of apache.

phpMyAdmin

Step 5:

Go inside the conf folder of apache in c drive and open httpd file.

phpMyAdmin

Step 6:

Press Ctrl+F key and find index.html written in the file. Now, replace .html extension with .php and save the file.

phpMyAdmin
phpMyAdmin

Step 7:

Now check the status that apache server is running or not from the services of your computer system? If it is not running, then we need to run the apache server to open phpMyAdmin interface on the browser.

phpMyAdmin

Step 8:

Now open the browser and type http://localhost/phpmyadmin/. phpMyAdmin will start running in the browser.

phpMyAdmin

How to work with phpMyAdmin?

Click on New (1) to create a database and enter the database name in Create database (2) field and then click on Create (3) button. We can create any number of databases.

phpMyAdmin

Enter the table name, number of columns, and click on Go. A message will show that the table is created successfully.

phpMyAdmin

Now enter the field name, type, their size, and any constraint here and save it.

phpMyAdmin

The table is created successfully. We can make changes in the table from here.

phpMyAdmin

Database creation using coding with phpMyAdmin

We can create the database and tables using phpMyAdmin graphical user interface as well as with coding in php.

<?php  
    $servername = "localhost";  
    $username = "root";  //default user name is root  
    $password = "";     //default password is blank  
    $conn = mysqli_connect($servername, $username, $password);  
    if(!$conn)  
        die("Connection failed".mysqli_connect_error());  
    else      
        //echo "Successfully connected with database";  
    $query = "CREATE DATABASE newDB";  
    if (mysqli_query($conn, $query)) {  
        echo "Database created successfully with the name newDB";  
    } else {  
        echo "Error creating database: " . mysqli_error($conn);  
    }  
    mysqli_close($conn);  
?>  

Output:

Database created successfully with the name newDB.

phpMyAdmin

Database connectivity with phpMyAdmin

In phpMyAdmin, we create a database using a graphical user interface as well as by running queries.

<?php  
    $dbhost="localhost";  
    $dbName="newDB";  
    $user="root";  
    $pass="";  
    $conn = new mysqli("mysql:host=$dbhost;dbname=$dbName",$user,$pass);  
    try{  
        echo "Successfully connected with newdb database";  
    }  
    catch(Exception $e){  
            die("Connection failed".$e->getMessage());  
    }  
?>  

Output:

Successfully connected with the database.

phpMyAdmin

PHP Functions

PHP function is a piece of code that can be reused many times. It can take input as argument list and return value. There are thousands of built-in functions in PHP.

In PHP, we can define Conditional functionFunction within Function and Recursive function also.


Advantage of PHP Functions

Code Reusability: PHP functions are defined only once and can be invoked many times, like in other programming languages.

Less Code: It saves a lot of code because you don’t need to write the logic many times. By the use of function, you can write the logic only once and reuse it.

Easy to understand: PHP functions separate the programming logic. So it is easier to understand the flow of the application because every logic is divided in the form of functions.


PHP User-defined Functions

We can declare and call user-defined functions easily. Let’s see the syntax to declare user-defined functions.

Syntax

  

function functionname(){  
//code to be executed  
}

Note: Function name must be start with letter and underscore only like other labels in PHP. It can’t be start with numbers or special symbols.

PHP Functions Example

<?php  
function sayHello(){  
echo "Hello PHP Function";  
}  
sayHello();//calling function  
?>  

Output:Hello PHP Function

PHP Function Arguments

We can pass the information in PHP function through arguments which is separated by comma.

PHP supports Call by Value (default), Call by ReferenceDefault argument values and Variable-length argument list.

  

<?php  
function sayHello($name){  
echo "Hello $name<br/>";  
}  
sayHello("Sonoo");  
sayHello("Vimal");  
sayHello("John");  
?>

Output:

Hello Sonoo
Hello Vimal
Hello John
<?php  
function sayHello($name,$age){  
echo "Hello $name, you are $age years old<br/>";  
}  
sayHello("Sonoo",27);  
sayHello("Vimal",29);  
sayHello("John",23);  
?>  

Output:

Hello Sonoo, you are 27 years old
Hello Vimal, you are 29 years old
Hello John, you are 23 years old

PHP Call By Reference

Value passed to the function doesn’t modify the actual value by default (call by value). But we can do so by passing value as a reference.

By default, value passed to the function is call by value. To pass value as a reference, you need to use ampersand (&) symbol before the argument name.

<?php  
function adder(&$str2)  
{  
    $str2 .= 'Call By Reference';  
}  
$str = 'Hello ';  
adder($str);  
echo $str;  
?>  

Output:

Hello Call By Reference

PHP Function: Default Argument Value

We can specify a default argument value in function. While calling PHP function if you don’t specify any argument, it will take the default argument. Let’s see a simple example of using default argument value in PHP function.File: functiondefaultarg.php

<?php  
function sayHello($name="Sonoo"){  
echo "Hello $name<br/>";  
}  
sayHello("Rajesh");  
sayHello();//passing no value  
sayHello("John");  
?>  

Output:

Hello Rajesh
Hello Sonoo
Hello John

PHP Function: Returning Value

Let’s see an example of PHP function that returns value.File: functiondefaultarg.php

<?php  
function cube($n){  
return $n*$n*$n;  
}  
echo "Cube of 3 is: ".cube(3);  
?>  

Output:

Cube of 3 is: 27

Javascript Features

JavaScript is one of the most popular languages which includes numerous features when it comes to web development. It’s amongst the top programming languages as per Github and we must know the features of JavaScript properly to understand what it is capable of.

Some of the features are lightweight, dynamic, functional and interpreted. Now we are going to discuss some important features of JavaScript.

  • Light Weight Scripting language
  • Dynamic Typing
  • Object-oriented programming support
  • Functional Style
  • Platform Independent
  • Prototype-based
  • Interpreted Language
  • Async Processing
  • Client-Side Validation
  • More control in the browser

Let’s see all of these features in detail so that you can understand them. Some of the above-specified features are old JavaScript features while some of them are new features.

1. Light Weight Scripting Language

JavaScript is a lightweight scripting language because it is made for data handling at the browser only. Since it is not a general-purpose language so it has a limited set of libraries. Also as it is only meant for client-side execution and that too for web applications, hence the lightweight nature of JavaScript is a great feature.

2. Dynamic Typing

JavaScript supports dynamic typing which means types of the variable are defined based on the stored value. For example, if you declare a variable x then you can store either a string or a Number type value or an array or an object. This is known as dynamic typing.

To understand this, in languages like Java, we explicitly mention that a particular variable will store a certain type of data, whereas in JavaScript we do not have to provide the data type while declaring a variable. In JavaScript, we just have to use var or let keyword before the variable name to declare a variable without worrying about its type.

3. Object-Oriented Programming Support

Starting from ES6, the concept of class and OOPs has been more refined. Also, in JavaScript, two important principles with OOP in JavaScript are Object Creation patterns (Encapsulation) and Code Reuse patterns (Inheritance). Although JavaScript developers rarely use this feature but its there for everyone to explore.

3. Functional Style

This implies that JavaScript uses a functional approach, even objects are created from the constructor functions and each constructor function represents a unique object-type. Also, functions in JavaScript can be used as objects and can be passed to other functions too.

4. Platform Independent

This implies that JavaScript is platform-independent or we can say it is portable; which simply means that you can simply write the script once and run it anywhere and anytime. In general, you can write your JavaScript applications and run them on any platform or any browser without affecting the output of the Script.

5. Prototype-based Language

JavaScript is a prototype-based scripting Language. This means javascript uses prototypes instead of classes or inheritance. In languages like Java, we create a class and then we create objects for those classes. But in JavaScript, we define object prototype and then more objects can be created using this object prototype.

7. Interpreted Language

JavaScript is an interpreted language which means the script written inside javascript is processed line by line. These Scripts are interpreted by JavaScript interpreter which is a built-in component of the Web browser. But these days many JavaScript engines in browsers like the V8 engine in chrome uses just in time compilation for JavaScript code.

8. Async Processing

JavaScript supports Promise which enables asynchronous requests wherein a request is initiated and JavaScript doesn’t have to wait for the response, which at times blocks the request processing. Also starting from ES8, Async functions are also supported in JavaScript, these functions don’t execute one by one, rather they are processed parallelly which has a positive effect on the processing time, reducing it to a great extent.

9. Client-side Validations

This is a feature which is available in JavaScript since forever and is still widely used because every website has a form in which users enter values, and to make sure that users enter the correct value, we must put proper validations in place, both on the client-side and on the server-side. JavaScript is used for implementing client-side validations.

10. More control in Browser

JavaScript being a client-side language provides many features that help developers to divide processing between browser and server hence reducing the load on servers by having basic processing, validations, temporary data saving using cookies, etc on the browser itself.

Along with all these features, JavaScript provides the following useful features too:

  • Detecting browser type, name OS version, etc information of the client for analysis.
  • Extensive in-built library with many useful functions for validation, data type conversion, string operations, etc.
  • It is an object-centered language with Window Object being the most important object in JavaScript and it also supports Polymorphism.
  • Support for commonly used complex data types like array, Maps, List, etc. with support of in-built functions to operate on them.