whmcs tblconfiguration DisplayErrors
This is a small note on changing the value of DisplayErrors within a WHMCS instance. This is a setting within the tblconfiguration table.
I was asked to look into this when it was apparent that PHPmyAdmin did not want to update the value. PHPMyAdmin was reporting: "Current Selection does not contain a unique column. Grid edit, checkbox, Edit, Copy and Delete are not available" with a handy little (?) at the end of that line. Oh, and it's not in red, so it took the slow of mind such as myself to treat it as a warning/advisory. Thank you PHPMyAdmin:
So the first thing I did was to go and see the physical make up of the table:
MariaDB [devbillinghostin_restore_040418]> describe tblconfiguration;
+------------+-----------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+-----------+------+-----+---------------------+-------+
| setting | text | NO | MUL | NULL | |
| value | text | NO | | NULL | |
| created_at | timestamp | NO | | 0000-00-00 00:00:00 | |
| updated_at | timestamp | NO | | 0000-00-00 00:00:00 | |
+------------+-----------+------+-----+---------------------+-------+
4 rows in set (0.00 sec)
+------------+-----------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+-----------+------+-----+---------------------+-------+
| setting | text | NO | MUL | NULL | |
| value | text | NO | | NULL | |
| created_at | timestamp | NO | | 0000-00-00 00:00:00 | |
| updated_at | timestamp | NO | | 0000-00-00 00:00:00 | |
+------------+-----------+------+-----+---------------------+-------+
4 rows in set (0.00 sec)
Sure enough, it has a key, there is nothing really all that strange about this table - it's just not relational - it is a "configuration file" if you will. So let's set a value.
First of all I checked what this was currently set to:
MariaDB [blahblah123]> SELECT * FROM tblconfiguration WHERE setting='DisplayErrors';
+---------------+-------+---------------------+---------------------+
| setting | value | created_at | updated_at |
+---------------+-------+---------------------+---------------------+
| DisplayErrors | | 0000-00-00 00:00:00 | 2018-04-30 09:37:52 |
+---------------+-------+---------------------+---------------------+
1 row in set (0.00 sec)
+---------------+-------+---------------------+---------------------+
| setting | value | created_at | updated_at |
+---------------+-------+---------------------+---------------------+
| DisplayErrors | | 0000-00-00 00:00:00 | 2018-04-30 09:37:52 |
+---------------+-------+---------------------+---------------------+
1 row in set (0.00 sec)
Then attempted to update the value:
MariaDB [blahblah123]> UPDATE tblconfiguration SET value='on' WHERE setting='DisplayErrors';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Which shows as having updated a row, so its safe to assume it worked as expected - but let's just check anyway:
MariaDB [blahblah123]> SELECT * FROM tblconfiguration WHERE setting='DisplayErrors';
+---------------+-------+---------------------+---------------------+
| setting | value | created_at | updated_at |
+---------------+-------+---------------------+---------------------+
| DisplayErrors | on | 0000-00-00 00:00:00 | 2018-04-30 09:37:52 |
+---------------+-------+---------------------+---------------------+
1 row in set (0.00 sec)
+---------------+-------+---------------------+---------------------+
| setting | value | created_at | updated_at |
+---------------+-------+---------------------+---------------------+
| DisplayErrors | on | 0000-00-00 00:00:00 | 2018-04-30 09:37:52 |
+---------------+-------+---------------------+---------------------+
1 row in set (0.00 sec)
While this did not resolve the issue they were looking to fix - it is likely something that I will need to revisit in the future with that oh-so-familiar "now I know I have done this before" gormless expression. Planning ahead is always good, and Sun Tsu had a great deal to say about knowing yourself... although I am not sure it is relevant to gormless expressions and blank minds ;)