User management gives an SQL error #2040

Closed
opened 2026-10-05 01:04:31 +02:00 by adam · 1 comment
Owner

Hi all,

Piwigo running with the last version.
I don't know since when (very low traffic on this piwigo), but this week-end, when I tried to add a user, I discovered that when I go to Administration->Users->Manage I'm getting an error.
(xxx is not the real name of the folder)

Fatal error: Uncaught mysqli_sql_exception: Unknown column 'username' in 'SELECT' in /home/xxx/photos/include/dblayer/functions_mysqli.inc.php:132 Stack trace: #0 /home/xxx/photos/include/dblayer/functions_mysqli.inc.php(132): mysqli->query('\nSELECT\n use...') #1 /home/xxx/photos/include/dblayer/functions_mysqli.inc.php(888): pwg_query('\nSELECT\n use...') #2 /home/xxx/photos/admin/user_list.php(121): query2array('\nSELECT\n use...', NULL, 'username') #3 /home/xxx/photos/admin.php(406): include('/home/xxx/...') #4 {main} thrown in /home/xxx/photos/include/dblayer/functions_mysqli.inc.php on line 132

I tried to repair the DB using the piwigo maintenance tool, but the reult is the same.
Everything else seems to be OK.

Any Idea how to solve this ?

Thanks in advance.

Hi all, Piwigo running with the last version. I don't know since when (very low traffic on this piwigo), but this week-end, when I tried to add a user, I discovered that when I go to Administration->Users->Manage I'm getting an error. (xxx is not the real name of the folder) _Fatal error: Uncaught mysqli_sql_exception: Unknown column 'username' in 'SELECT' in /home/xxx/photos/include/dblayer/functions_mysqli.inc.php:132 Stack trace: #0 /home/xxx/photos/include/dblayer/functions_mysqli.inc.php(132): mysqli->query('\nSELECT\n use...') #1 /home/xxx/photos/include/dblayer/functions_mysqli.inc.php(888): pwg_query('\nSELECT\n use...') #2 /home/xxx/photos/admin/user_list.php(121): query2array('\nSELECT\n use...', NULL, 'username') #3 /home/xxx/photos/admin.php(406): include('/home/xxx/...') #4 {main} thrown in /home/xxx/photos/include/dblayer/functions_mysqli.inc.php on line 132_ I tried to repair the DB using the piwigo maintenance tool, but the reult is the same. Everything else seems to be OK. Any Idea how to solve this ? Thanks in advance. <!-- github-sync-id:2943612692 -->
adam closed this issue 2026-10-05 01:04:31 +02:00
Author
Owner

Can you look directly in the database to see if the structure of the users table is correct?

MariaDB [piwigo_db]> desc piwigo_users;
+-------------------+-----------------------+------+-----+---------+----------------+
| Field             | Type                  | Null | Key | Default | Extra          |
+-------------------+-----------------------+------+-----+---------+----------------+
| id                | mediumint(8) unsigned | NO   | PRI | NULL    | auto_increment |
| username          | varchar(100)          | NO   | UNI |         |                |
| password          | varchar(255)          | YES  |     | NULL    |                |
| mail_address      | varchar(255)          | YES  |     | NULL    |                |
+-------------------+-----------------------+------+-----+---------+----------------+
Can you look directly in the database to see if the structure of the `users` table is correct? ```sql MariaDB [piwigo_db]> desc piwigo_users; +-------------------+-----------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------------+-----------------------+------+-----+---------+----------------+ | id | mediumint(8) unsigned | NO | PRI | NULL | auto_increment | | username | varchar(100) | NO | UNI | | | | password | varchar(255) | YES | | NULL | | | mail_address | varchar(255) | YES | | NULL | | +-------------------+-----------------------+------+-----+---------+----------------+ ``` <!-- github-comment-id:2976701799 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#2040