Save data in database with HTML tag in Joomla

Varun
save-data-in-database-with-html-tag-in-joomla

A Joomla site consists of a single database and a big number of files and directories. Joomla keeps the majority of its data in this database, from article content to menu items, users to extension settings. In this post, we’ll show you how to use phpMyAdmin to connect to the Joomla database.

Many features of Joomla aid in the work of securing apps and extensions created on it. If at all possible, you should use these features because they have been tried and checked by many eyes in the development community, and any updates that may be required in the future will be automatically available anytime a Joomla update is applied. The following is an explanation of best practises for using the Joomla API to ensure the security of your extensions.

What exactly is a database?

A database is a collection of structured data stored as one or more tables. This is comparable to, say, an Excel Worksheet, which has numerous tabs, each with a table containing distinct data organised into rows and columns.

How do people work with databases?

There are several methods for accessing and editing databases: MySQL is the most widely used database system. Many database-driven apps, such as Joomla, make extensive use of it. The most common open source tool for accessing and editing MySQL databases is phpMyAdmin. It can be used to view/edit data, create/restore backups, and perform a variety of other tasks.

Adding/Accessing phpMyAdmin

phpMyAdmin is a PHP-based programme that can be quickly uploaded to any webspace and run in your browser. However, because it is so prevalent, many web providers supply a pre-installed version to save time.

  • phpMyAdmin with a WebHost
  • Open the admin panel of your webhost
  • Search for the link to phpMyAdmin (it varies across hosting providers)
  • Login with the username and password specified in your admin panel
  • Download phpMyAdmin from the official site

Extract the .zip file

  • Rename config.sample.inc.php to config.inc.php
  • Open the file with a text editor and the localhost to the location of your database hostname

$cfg['Servers'][$i]['host'] = 'localhost’;

Add a ‘Blowfish Secret’

  • Create a random string containing 32 characters
  • Add a line in the config.inc.php

$cfg['blowfish_secret'] = 'PutTheRandom32CharacterStringHere';

Upload the folder to your Joomla directory

Go to the phpMyAdmin URL (usually www.yoursite.com/phpmyadmin)

  • Login using your username and password

Basic usage of phpMyAdmin

Hopefully by now you’ve managed to sign into phpMyAdmin.

Now let’s access your database!

List of databases

Click on the ‘Databases’ tab. This will open a list of the databases in your phpMyAdmin instance.

Tables in a database

Upon opening one database, you will see various tables. Each of these tables has a specific purpose. All of them have the same prefix, the one that was setup when installing Joomla. Upon closer inspection, you will most likely realise what some of them do. Let’s open one of the tables and see what it contains.

Opening a table

I have chosen the Joomla Users table. Can you guess which data will be stored here?

Yep! Here you can find all of the users registered on your Joomla site. Their usernames, emails, dates of registration, dates last visited…even their passwords.

It’s easy to change any value by simply double clicking it. Everything is automated and gets saved the moment you press the Enter key.

Backing up (exporting) a database

Backing up your database is an easy and quick procedure. Choose the database you wish to backup and press the ‘Export’ button above.

This will open a window asking you for some additional details.

Since we are making a simple backup, there is no need to change anything. Press GO and your database will be downloaded in SQL format.

You have a file which contains your full database. Store it somewhere safe and hopefully you won’t have to use it ever again.

In case you have problems and wish to restore, the procedure is pretty straightforward…

Restoring (importing) my database

If you made a backup like we mentioned previously, the process of restoring is also quite simple.

Clicking the ‘Import’ button will bring you to a window requiring you to choose a .sql file from your computer. You have that file, right?

Find the required .sql file and press GO.

After a few moments, you should have a database with the data from the .sql file.

This concludes our article about simple database manipulation using phpMyAdmin.

Business
info@corewaysolution.com
© 2023, Corewaysolution. All Rights Reserved. Privacy Policy | Refund Policy