How to learn PHP and SQL on Android using Termux

PHP is a server scripting language and a powerful tool for making dynamic and interactive Web pages.

With PHP, you can connect and manipulate databases.

MySQL is the most popular database system used with PHP.

Learn PHP and SQL on Smartphone - TechSheet
If you're interested to learn PHP and SQL, but don't have a computer. Don't worry!

In this article, we are going to talk about how to learn PHP and SQL using Termux on your Android.
So, let's begin!

Learn PHP and SQL on Android using Termux

First of, we need to install the latest version of Termux and the latest version is 0.118.0

The latest version is not available in the Google Play Store. So, we will install it from F-Droid.

Because, Termux's official website recommends installing the latest version of Termux from F-Droid. As you can see in the picture below.

So, just go to F-Droid. You will see the F-Droid website as below. ‌Now scroll down and click on the 'Download F-DROID' button to install F-Droid. Then we will be able to install the latest version of Termux.

Download Fdroid - TechSheet

You need to install F-Droid after downloading. Then, we will open it. After that, we will search Termux on Fdroid as below.

Search Termux on Fdroid - TechSheet

Then, click on Termux. As you can see in the picture above. Now install the latest version of Termux.

After installing Termux type the following commands one by one and press enter after typing each command...

  1. apt update command lets your system know which packages are available for upgrade, and where the software needs to be restored.
  2. apt upgrade -y can then act on this information and upgrade all installed packages to their latest versions.
  3. termux-setup-storage to allow Termux to access photos, media and files on your device.
  4. pkg install php to install the latest version of PHP.
  5. pkg install nano It's a editor. You can edit PHP file by this nano editor.
  6. nano filename.php to open a PHP file. Then, you can write PHP code to this file.
  7. php filename.php to run this PHP file.

So, we've installed PHP.  Similarly, we can install SQL on our Android to retrieve data from database.

Data retrieval is the use of SQL as a data query language to display data from a database table. The data query language is used to query the required data from the database.

Now, let me show you how to install SQL on our Android.

Open the Termux again. If you've already installed PHP type the following commands one by one and press enter after typing each command...
  1. pkg install mariadb To install mysql. Mysql and Mariadb are the same thing.
  2. mysqld_safe -u root & 
  3. mysql To run the mysql.
  4. CREATE DATABASE database_name; To create database.
  5. SHOW DATABASES; To show a list of databases.
  6. USE database_name; To run the database.
  7. CREATE TABLE table_name (id int(5), Name varchar(20), Email varchar(50)); Data is defined using SQL through CREATE statement.
  8. SHOW TABLES; To show a list of tables in the database.
  9. INSERT INTO table_name (id, Name, Email) VALUES(1, "Your name", "email address"); The INSERT command is used to enter one or more records.
  10. SELECT id, Name, Email FROM table_name; The SELECT statement is used to search the required information from the database. Data manipulation can be done using many more clauses with SELECT statement.
  11. UPDATE table_name SET Name = "Another name" WHERE Name = "Previous name"; The UPDATE command is used to update one or more records from the database.
  12. DELETE table_name WHERE Name="previous name"; The DELETE command is used to delete one or more records from database.


Let's Conclude

This is an article about learning PHP and SQL on your smartphone using Temux.  Now you can learn PHP and SQL using just a smartphone.  There are also many PHP and SQL tutorials available on the Internet.

Next Post Previous Post
No Comment
Add Comment
comment url