📜 ⬆️ ⬇️

DataIncrement - addition to the capabilities of phpMyAdmin

When you use something like phpMyAdmin to work with data in the database, it is always inconvenient that the associated field displays just a number from another table, instead of the specific data that is hidden there.

For example, in the `country_id` field there are numbers, not the name of the country. You have to jump from table to table. Or write a separate sql, which is often inconvenient, if you need to quickly. Or dial the sql query from the hand from the phone. And if you need to update the country from the field `country_id`, then again jump from table to table. In short, all this is inconvenient.

It is easier to show in the format was-became:

It was
')
image

It became

image

Task


Make a simple setting for the database fields to display related data from other tables. And so that they can be updated right there.

Decision


This task tormented me a long time ago, due to the nature of my web development. There were several approaches to the projectile, and as a result I settled on the simplest solution I could come up with. And most importantly, who would like to use myself, and not solve the abstract problem of abstract users.

The result is a site DataIncrement.com

How DataIncrement Works


  1. We connect our database to DataIncrement using host , name , pass , dbname (the password is stored in the browser cookies or in the session, that is, it is not stored on the site, if that). You must have a user with the ability to connect from any host.
  2. Registration of all actions occurs through confirmation by mail. Perhaps this is a controversial decision, but so far. Therefore, we go to the mail and click the link from the letter. Thus we confirm the connection.
  3. After that you can go to the list of connected databases on the main page dataincrement.com
  4. Then click on the connected database - it will be a page with a list of all available tables.
  5. Next, you need to go to the “Links” tab (the second link from the name of the base “Example of the base” in the pictures “It was Become”), where you need to configure the connection between the tables to display the related data. Using a non-clever text entry, for example:

@link city country_id = country.country_id name region_id = region.region_id name 

Where:


Thus, we get the table display from the “Became” image, where besides the real value of the field, the value of the field `country`.`name` is displayed through a semicolon. In the same way, the setting is made for another field `region_id` , which is connected as it can be seen from the setting with the field `region`.`region_id` .

image

Editing


Data editing is done by double clicking in a table cell. Then at the bottom of the page there is a special. panel where you can change the value and send the data to change.

In addition to editing simple fields, in the future I plan to search by related fields. For example, in order to change a country, it was possible to type in a part of the name and the desired id itself was proposed for filling. Actually, this is a standard function of prompts when typing a search query.

Similar syntax will be used to set up search queries, just like for the @link sections, only with the @search keyword @search

 @search city country_id = country.country_id 10 name $* 

where the difference is that:

  1. indicates the limit of the returned rows, separated by a space - this is the number 10
    country_id = country.country_id 10
  2. then the fields for displaying are indicated, but separated by a space, the search pattern is additionally indicated, where the dollar $ is the entered value and the asterisk * means any characters you like.
    Now I have $ * specified for the field `country`.`name`, i.e. searching by name will work by the initial letters of the words in the specified field.
    A template can have four options: $ , * $ , $ * , * $ *

Conclusion


At the moment, the site is quite a working prototype, and can be shown in light without shame. What actually gave rise to this note.

There are a lot of ideas and plans, but while this project is being held by me as a hobby, criticism is accepted as food for thought. At least in order for me to quit doing these nonsense and start doing other nonsense.

The note is written as an attempt not to clutter up the main page of the DI with all sorts of "landing pages" with a description of what is not clear, but so that you can give a link to the description and principle of operation. In addition, immediately with independent criticism, from the series - "they also told you."

Source: https://habr.com/ru/post/425939/


All Articles