How to build a shortcode which can insert a query string into a DB table

Short codes are for generating HTML for the front end, and no front end functionality should write to the DB because:

  1. With enough traffic it will bring down your site.
  2. If you use caching or CDN for your content it will simply not work at all, if you expect it to work for all page loads.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)