Дата: 25.11.2013
Автор: Даниил Каменский , dkamenskiy (at) yandex (dot) ru
При использовании ряда CMS (например, DLE, vBulletin и др.) временами возникает ошибка mysql с номером 1054.
Текст ошибки Unknown column ‘ИМЯ_СТОЛБЦА’ in ‘field list’ в переводе означает «Неизвестный столбец ‘ИМЯ_СТОЛБЦА’ в списке полей.«. Такая ошибка возникает в том случае, если попытаться выбрать (запрос вида select) или изменить (запрос вида update) данные из столбца, которого не существует. Ошибка чаще всего возникает из-за стoронних модулей. Перечислим несколько возможных причин:
- установлен модуль, расчитанный на более новую версию CMS, чем используемая;
- при установке модуля не выполнились операции изменения структуры таблиц;
- после установки сторонних модулей выполнено обновление системы, которое привело к изменению структуры таблиц; при этом модуль не был обновлен на совместимый;
- Из резервной копии восстановлена более старая база данных, а файлы сайта остались в новой версии.
Пример №1:
Имеется таблица сотрудников подразделения.
Поля: id, фамилия, имя, отчество, год рождения, наличие высшего образования.
create table if not exists employee
(
`id` int(11) NOT NULL auto_increment primary key,
`surname` varchar(255) not null,
`name` varchar(255) not null,
`patronymic` varchar(255) not null,
`year_of_birth` int unsigned default 0,
`higher_education` tinyint unsigned default 0
) ENGINE=MyISAM;
Если обратиться к этой таблице с запросом на выборку несуществующего поля, например пола сотрудника по фамилии Власенко, то результатом будет вышеуказанная ошибка:
mysql> select sex from employee where surname=’Власенко’;
ERROR 1054 (42S22): Unknown column ‘sex’ in ‘field list’
Пример №2:
Воспользуемся той же таблицей из примера 1. Если попытаться указать мужской пол у сотрудника по имени Власенко (выяснилось его имя и стало ясно, что это мужчина), то результатом будет та же ошибка:
mysql> update employee set sex=1 where surname=’Власенко’;
ERROR 1054 (42S22): Unknown column ‘sex’ in ‘field list’
Способы борьбы
Самый корректный способ борьбы в устранении причины ошибки. Например, все обновления сайта рекомендуем выполнять сначала на копии сайта и если ошибок нет, то повторять на рабочем сайте. Если при обновлении возникла ошибка, следует найти способ сделать обновление корректно с учетом версий сторонних модулей.
Если по каким-то причинам корректно избежать ошибки не получилось, можно прибегнуть к симптоматическому лечению, которое состоит в простом добавлении недостающих полей в таблицу.
Запрос на добавление:
ALTER TABLE employee ADD COLUMN sex ENUM(‘male’, ‘female’) DEFAULT ‘female’
Что в переводе означает «Изменить таблицу employee, добавив столбец `пол`, назначив ему тип перечисление(мужской/женский) по умолчанию мужской».
При таком добавлении столбца необходимо учитывать, что у всех записей в таблице в столбце sex появится значение по умолчанию. Если добавлять такой столбец как пол (который не может быть равен null и обязательно присутствует у каждого человека), то просто необходимо сразу же
после этого прописать нужное значение во все записи в таблице. В данном случае с добавлением столбца «пол» нужно будет поменять значение на male у всех сотрудников мужского пола.
Трудности могут возникнуть из-за того, что часто нужно самостоятельно определять тип добавляемого столбца.
Примеры:
a) Запрос:
SELECT faqname, faqparent, displayorder, volatile FROM faq where product
IN (», ‘vbulletin’, ‘watermark’, ‘cyb_sfa’, ‘access_post_and_days’);
Ответ сервера:
Invalid SQL: SELECT faqname, faqparent, displayorder, volatile FROM faq where
product IN (», ‘vbulletin’, ‘watermark’, ‘cyb_sfa’, ‘access_post_and_days’);
MySQL Error: Unknown column ‘faqname’ in ‘field list’
Error Number: 1054
Отсутствует столбец faqname, добавим его. Логика подсказывает, что если имя — то это скорее всего символы, а не целое число или тип datetime. Количество символов заранее, конечно, неизвестно, но редко имя бывает больше чем 255 символов. Поэтому добавим столбец faqname с указанием типа varchar(255):
ALTER TABLE faq ADD faqname varchar(255)
б) Запроc:
UPDATE dle_usergroups set group_name=‘Журналисты’, allow_html=‘0’ WHERE id=‘3’;
Ответ сервера:
Invalid SQL: UPDATE dle_usergroups set group_name=’Журналисты’, allow_html=’0′ WHERE id=’3′;
MySQL Error: Unknown column ‘allow_html’ in ‘field list’
Error Number: 1054
Отсутствует столбец allow_html, добавим его. Смотрим на то значение, которое туда пытается вставить запрос, видим 0. Скорее всего этот столбец может принимать два значения — разрешить/не разрешить (1 или 0), то есть однобайтное целое число вполне подойдёт. Поэтому добавим столбец allow_html с указанием типа tinyint:
ALTER TABLE faq ADD allow_html tinyint
Таким образом можно составить шаблон для «лечения» таких проблем: ALTER TABLE [a] ADD [b] [c];, где
a — имя таблицы, откуда выбираются (или где обновляются) данные;
b — имя столбца, который нужно добавить;
c — тип данных.
Примеры (во всех примерах идёт работа с таблицей dle_usergroups):
1) Запрос:
UPDATE dle_usergroups set group_name=‘Журналисты’, allow_html=‘0’ WHERE id=‘3’;
Ответ сервера:
Invalid SQL: UPDATE dle_usergroups set group_name=’Журналисты’, allow_html=’0′ WHERE id=’3′;
MySQL Error: Unknown column ‘allow_html’ in ‘field list’
Error Number: 1054
Решение:
a=dle_usergroups, b=allow_html, c=tinyint, то есть
ALTER TABLE dle_usergroups ADD allow_html tinyint
Для того, чтобы выполнить исправляющий ошибку запрос, необходимо воспользоваться каким-либо mysql-клиентом. В стандартной поставке mysql всегда идёт консольный клиент с названием mysql (в windows mysql.exe). Для того, чтобы подключиться к mysql выполните команду
mysql -hНАЗВАНИЕ_ХОСТА -uИМЯ_ПОЛЬЗОВАТЕЛЯ -pПАРОЛЬ ИМЯ_БАЗЫ_ДАННЫХ,
после чего введите необходимый запрос и точку с запятой после него в появившейся командной строке.
В том случае, если работа происходит на чужом сервере (например, арендуется хостинг) и нет возможности воспользоваться mysql-клиентом из командной строки (не всегда хостеры представляют такую возможность), можно воспользоваться тем инструментом, который предоставляет хостер — например, phpMyAdmin, и в нём ввести нужный sql-запрос.
В то же время наиболее подходящий инструмент для работы с mysql — это MySQL Workbench — разработка создателей mysql с достаточно удобным пользовательским интерфейсом.
Если же нет возможности подключиться к mysql напрямую (например из-за ограничений файрвола), то в ряде случаев возможно удалённо подключиться к MySQL-серверу через SSH-туннель.
2) Запрос:
UPDATE dle_usergroups set group_name=‘Журналисты’, allow_subscribe=‘0’ WHERE id=‘3’;
Ответ сервера:
Invalid SQL: UPDATE dle_usergroups set group_name=’Журналисты’, allow_subscribe=’0′ WHERE id=’3′;
MySQL Error: Unknown column ‘allow_subscribe’ in ‘field list’
Error Number: 1054
Решение:
a=dle_usergroups, b=allow_subscribe, c=tinyint, то есть
ALTER TABLE dle_usergroups ADD allow_subscribe tinyint
3) Запрос:
SELECT faqname, faqparent, displayorder, volatile FROM faq where product IN (», ‘vbulletin’, ‘watermark’, ‘cyb_sfa’, ‘access_post_and_days’);
Oтвет сервера:
InvalidSQL: SELECT faqname, faqparent, displayorder, volatile FROM faq where product IN (», ‘vbulletin’, ‘watermark’, ‘cyb_sfa’, ‘access_post_and_days’);
MySQL Error: Unknown column ‘faqname’ in ‘field list’
Error Number: 1054
Решение:
a= faq, b=faqname, c=varchar(255), то есть
ALTER TABLE faq ADD faqname varchar(255)
Результат
В результате добавления необходимого поля ошибка должна исчезнуть. Однако, существует вероятность того, что в структуре таблиц не хватало несколько столбцов: в этом случае ошибка повторится с указанием другого имени столбца, для которого потребуется повторить процедуру. Помните, что добавление незаполненных столбцов угаданного типа не всегда будет соответствовать задуманной логике приложения и может нарушить часть функциональности.
Источник: webew.ru
Дата публикации: 25.11.2013
© Все права на данную статью принадлежат порталу SQLInfo.ru. Перепечатка в интернет-изданиях разрешается только с указанием автора и прямой ссылки на оригинальную статью. Перепечатка в бумажных изданиях допускается только с разрешения редакции.
I have a PHP script and for some reason mysql keeps treating the value to select/insert as a column. Here is an example of my sql query:
$query = mysql_query("SELECT * FROM tutorial.users WHERE (uname=`".mysql_real_escape_string($username)."`)") or die(mysql_error());
That turns into:
SELECT * FROM tutorial.users WHERE (uname=`test`)
The error was:
Unknown column ‘test’ in ‘where
clause’
I have also tried:
SELECT * FROM tutorial.users WHERE uname=`test`
OMG Ponies
321k79 gold badges516 silver badges499 bronze badges
asked Sep 26, 2009 at 3:10
In MySql, backticks indicate that an indentifier is a column name. (Other RDBMS use brackets or double quotes for this).
So your query was, «give me all rows where the value in the column named ‘uname’ is equal to the value in the column named ‘test'». But since there is no column named test in your table, you get the error you saw.
Replace the backticks with single quotes.
answered Sep 26, 2009 at 3:43
tpditpdi
34.2k11 gold badges79 silver badges119 bronze badges
0
Weird? How so? It says exactly what’s wrong. There is no ‘test’ column in your table. Are you sure you have the right table? ‘tutorial.users’ ? Are you sure the table isn’t named differently? Maybe you meant to do
SELECT * from users WHERE uname = 'test';
You have to reference only the table name, not the database.. assuming the database is named tutorial
answered Sep 26, 2009 at 3:13
![]()
meder omuralievmeder omuraliev
181k70 gold badges385 silver badges428 bronze badges
2
example:
$uname = $_POST['username'];
$sql="SELECT * FROM Administrators WHERE Username LIKE '$uname'"
Note the single quotes around the $uname. When you echo the query, this is the output-
SELECT * FROM Administrators WHERE Username LIKE 'thierry'
However if you miss the quote around the $uname variable in your query, this is what you’ll get-
SELECT * FROM Administrators WHERE Username LIKE thierry
On MySQL server, the 2 queries are different. thierry is the input string and correctly encapsulated in quote marks, where as in the second query, it isn’t, which causes an error in MySQL.
I hope this helps and excuse my englis which is not very good
j0k
22.4k28 gold badges80 silver badges88 bronze badges
answered Jun 10, 2012 at 15:52
1
I had the same issue and it turned out to be a typo.
My error message was:
Unknown column 'departure' in 'where clause'
I checked that very column in my table and it turns out that, I had spelt it as «depature» and NOT «departure» in the table, therefore throwing the error message.
I subsequently changed my query to:
Unknown column 'depature' in 'where clause'
and it worked!
So my advise clearly is, double check that you spelt the column name properly.
I hope this helped.
I also faced the issue of «Unknown column in where clause» when executing the following from linux (bash) command line.
mysql -u support -pabc123 -e 'select * from test.sku where dispsku='test01' ; '
This is what I got
ERROR 1054 (42S22) at line 1: Unknown column 'test01' in 'where clause'
I had to replace the single quotes ‘test01’ with double quotes «test01» . It worked for me. There’s a difference how and the way you’re executing sql queries.
When assigning a value to a variable in a script and later, using that variable in a sql statement that has to be executed by the script, there’s slight difference.
If suppose variable is
var=testing
and you want to pass this value from within script to mysql, then single quotes work.
select '$var'
So different engines might evaluate backticks and quotes differently.
This is my query that worked from linux command line.
mysql -u support -pabc123 -e 'select * from test.sku where dispsku="test01" ; '
answered Apr 8, 2017 at 8:41
When you execute a MySQL statement, you may sometimes encounter ERROR 1054 as shown below:
mysql> SELECT user_name FROM users;
ERROR 1054 (42S22): Unknown column 'user_name' in 'field list'
The ERROR 1054 in MySQL occurs because MySQL can’t find the column or field you specified in your statement.
This error can happen when you execute any valid MySQL statements like a SELECT, INSERT, UPDATE, or ALTER TABLE statement.
This tutorial will help you fix the error by adjusting your SQL statements.
Let’s start with the SELECT statement.
Fix ERROR 1054 on a SELECT statement
To fix the error in your SELECT statement, you need to make sure that the column(s) you specified in your SQL statement actually exists in your database table.
Because the error above says that user_name column is unknown, let’s check the users table and see if the column exists or not.
To help you check the table in question, you can use the DESCRIBE or EXPLAIN statement to show your table information.
The example below shows the output of EXPLAIN statement for the users table:
mysql> EXPLAIN users;
+--------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+-------------+------+-----+---------+-------+
| username | varchar(25) | NO | | | |
| display_name | varchar(50) | NO | | | |
| age | int | YES | | NULL | |
| comments | text | YES | | NULL | |
+--------------+-------------+------+-----+---------+-------+
From the result above, you can see that the users table has no user_name field (column)
Instead, it has the username column without the underscore.
Knowing this, I can adjust my previous SQL query to fix the error:
SELECT username FROM users;
That should fix the error and your SQL query should show the result set.
Fix ERROR 1054 on an INSERT statement
When you specify column names in an INSERT statement, then the error can be triggered on an INSERT statement because of a wrong column name, just like in the SELECT statement.
First, you need to check that you have the right column names in your statement.
Once you are sure, the next step is to look at the VALUES() you specified in the statement.
For example, when I ran the following statement, I triggered the 1054 error:
mysql> INSERT INTO users(username, display_name)
-> VALUES ("jackolantern", Jack);
ERROR 1054 (42S22): Unknown column 'Jack' in 'field list'
The column names above are correct, and the error itself comes from the last entry in the VALUES() function.
The display_name column is of VARCHAR type, so MySQL expects you to insert a VARCHAR value into the column.
But Jack is not a VARCHAR value because it’s not enclosed in a quotation mark. MySQL considers the value to be a column name.
To fix the error above, simply add a quotation mark around the value. You can use both single quotes or double quotes as shown below:
INSERT INTO users(username, display_name)
VALUES ("jackolantern", 'Jack');
Now the INSERT statement should run without any error.
Fix ERROR 1054 on an UPDATE statement
To fix the 1054 error caused by an UPDATE statement, you need to look into the SET and WHERE clauses of your statement and make sure that the column names are all correct.
You can look at the error message that MySQL gave you to identify where the error is happening.
For example, the following SQL statement:
UPDATE users
SET username = "jackfrost", display_name = "Jack Frost"
WHERE user_name = "jackolantern";
Produces the following error:
ERROR 1054 (42S22): Unknown column 'user_name' in 'where clause'
The error clearly points toward the user_name column in the WHERE clause, so you only need to change that.
If the error points toward the field_list as shown below:
ERROR 1054 (42S22): Unknown column 'displayname' in 'field list'
Then you need to check on the SET statement and make sure that:
- You have the right column names
- Any
stringtype values are enclosed in a quotation mark
You can also check on the table name that you specified in the UPDATE statement and make sure that you’re operating on the right table.
Next, let’s look at how to fix the error on an ALTER TABLE statement
Fix ERROR 1054 on an ALTER TABLE statement
The error 1054 can also happen on an ALTER TABLE statement.
For example, the following statement tries to rename the displayname column to realname:
ALTER TABLE users
RENAME COLUMN displayname TO realname;
Because there’s no displayname column name in the table, MySQL will respond with the ERROR 1054 message.
Conclusion
In short, ERROR 1054 means that MySQL can’t find the column name that you specified in your SQL statements.
It doesn’t matter if you’re writing an INSERT, SELECT, or UPDATE statement.
There are only two things you need to check to fix the error:
- Make sure you’ve specified the right column name in your statement
- Make sure that any value of
stringtype in your statement is surrounded by a quotation mark
You can check on your table structure using the DESCRIBE or EXPLAIN statement to help you match the column name and type with your statement.
And that’s how you fix the MySQL ERROR 1054 caused by your SQL statements.
I hope this tutorial has been useful for you 🙏
That is not valid SQL — you are not referencing table_b in any FROM or JOIN clauses so can not use columns from it in SELECT, SET, WHERE or other parts.
Sticking to standards compliant SQL you need to use a sub-select here:
UPDATE table_a
SET table_a.course_start_date = (
SELECT table_b.fee_pay_date
FROM table_b
WHERE table_b.student_id = table_a.student_id
);
Some databases support using JOINs in UPDATE statements so avoid sub-selects. This can often be easier to read but will break if you need to support different database back-ends. For mySQL and MariaDB this would be something like:
UPDATE table_a
JOIN table_b
ON (table_a.student_id = table_b.student_id)
SET table_a.course_start_date = table_b.fee_pay_date
;
Not that both of these statements will update every row in table_a even if the row already has the right value so could be very inefficient if only a few rows actually need updating. This is by design, as you might want triggers to fire and so forth even for a NoOp update. To avoid this if it is not desirable add a WHERE clause to block unneeded updates:
UPDATE table_a
JOIN table_b
ON table_a.student_id = table_b.student_id
SET table_a.course_start_date = table_b.fee_pay_date
WHERE table_a.course_start_date <> table_b.fee_pay_date
OR (table_a.course_start_date IS NULL AND table_b.fee_pay_date IS NOT NULL)
OR (table_a.course_start_date IS NOT NULL AND table_b.fee_pay_date IS NULL)
;
or:
UPDATE table_a
JOIN table_b
ON table_a.student_id = table_b.student_id
SET table_a.course_start_date = table_b.fee_pay_date
WHERE COALESCE(table_a.course_start_date, '9999-01-01') <> COALESCE(table_b.fee_pay_date, '9999-01-01');
(you can simplify those WHERE clauses a bit if table_b.fee_pay_date can never be NULL)
As a related side-issue: to illustrate the concern of using non-standard syntax, the SQL Server equivalent to
UPDATE table_a
JOIN table_b
ON table_a.student_id = table_b.student_id
SET table_a.course_start_date = table_b.fee_pay_date
;
would be
UPDATE table_a
SET course_start_date = table_b.fee_pay_date
FROM table_a
JOIN table_b
ON table_a.student_id = table_b.student_id
;
and in postgres you would need:
UPDATE table_a
SET course_start_date = table_b.fee_pay_date
FROM table_b
WHERE table_a.student_id = table_b.student_id
;
Not vastly different, but if you want to support multiple databases or later move from one to another, you need to be careful of this sort of difference. The sub-query version should behave the same in all three (and most other places).
0 Пользователей и 1 Гость просматривают эту тему.
- 28 Ответов
- 7793 Просмотров

Здравствуйте !
Была проблема с логами, поэтому долго не обновлялась Joomla. Решил эту проблему и наконец-то запустил установку с версии 3.4 до версии 3.8. Но по окончании обновления в админке наблюдается такая картина: Белый экран, чёрная полоса сверху, в которой прописано: «Error displaying the error page» а в адресной строке «Ошибка 1054 unknown column ‘a.client_id’ in ‘where clause'»
Подскажите пожалуйста как исправить.
Буква а определяет имя таблицы в базе данных, ну а client_id это имя столбца которого нет в этой таблице…
К какому компоненту относится таблица в том и ищи проблему…
Записан
Занимаюсь создание расширений для Joomla 3.10.x и 4.2.x | Доработка и настройка сайтов. Занимаюсь создание Интернет магазинов с нуля на собственном компоненте + оптимизация загрузки страницы (после предоставляю техподдержку).
Работа с DOM деревом на PHP
Нужно фиксить базу данных.
Буква а определяет имя таблицы в базе данных, ну а client_id это имя столбца которого нет в этой таблице…
К какому компоненту относится таблица в том и ищи проблему…
Благодарю, но до сих пор не нашёл нужную таблицу. Чем руководствоваться в её поиске ?
Благодарю, но до сих пор не нашёл нужную таблицу. Чем руководствоваться в её поиске ?
А какую таблицу хоть искал?
Записан
Занимаюсь создание расширений для Joomla 3.10.x и 4.2.x | Доработка и настройка сайтов. Занимаюсь создание Интернет магазинов с нуля на собственном компоненте + оптимизация загрузки страницы (после предоставляю техподдержку).
Работа с DOM деревом на PHP
Решение
А именно: Менеджер расширений-> База данных-> Исправить
Записан
Оказываю услуги по Joomla | Миграция на Joomla 3.x | Сопровождение | IT-аутсорсинг | Недорогие домены и хостинг
А какую таблицу хоть искал?
Ну я копался в таблице updates, руководствуясь тем, что админка полетела после загрузки обновлений. Менял значение столбца client_id и тд. Пробовал удалять это обновление 3.8 оттуда. В общем походу занимался не тем.
Решение
А именно: Менеджер расширений-> База данных-> Исправить
Менеджер расширений же в самой админке ? А у меня она абсолютно полетела, нет никаких иконок и тд
Бекап обратно и правильность (пошаговость) обновления: сначало расширения, потом ядро.
Приоритеты в расширениях-сначало библиотеки.
Записан
Миграция, установка, обновление версий Joomla | Создание сайтов «под ключ» | Эксклюзивные заглушки «offline» | Работа с «напильником» над шаблонами и расширениями
Посмотрите таблицы #__menu_types, #__modules, #__menu, #__template_styles, #__extensions, #__session. Больше не нашел. Если найдете, то тип integer длину поставьте 11.
Посмотрите таблицы #__menu_types, #__modules, #__menu, #__template_styles, #__extensions, #__session. Больше не нашел. Если найдете, то тип integer длину поставьте 11.
Благодарю ! Добавил в ‘meny_tipes’ столбец ‘client_id’ — админка приобрела свой вид.
Теперь пролечите таблицы из админки. Может еще что не срастается.
Благодарю ! Добавил в ‘meny_tipes’ столбец ‘client_id’ — админка приобрела свой вид.
Действительно помогло! Спасибо!
У меня такая ошибка 1054 Unknown column ‘id’ in ‘where clause’. в какую таблицу мне нужно добавить столбец id?
У меня такая ошибка 1054 Unknown column ‘id’ in ‘where clause’. в какую таблицу мне нужно добавить столбец id?
В каком компоненте ошибка?
Записан
Занимаюсь создание расширений для Joomla 3.10.x и 4.2.x | Доработка и настройка сайтов. Занимаюсь создание Интернет магазинов с нуля на собственном компоненте + оптимизация загрузки страницы (после предоставляю техподдержку).
Работа с DOM деревом на PHP
Благодарю ! Добавил в ‘meny_tipes’ столбец ‘client_id’ — админка приобрела свой вид.
Доброго времени суток,
в какой папке смотрели, подскажите
Расскажите пожалуйста все поэтапно (подробно) как решить эту проблему, не понимаю где эту таблицу найти, в phpMyAdmin все посмотрел нет такой таблицы. Заранее спасибо!
запустите your-site-url.com/administrator/index.php?option=com_installer&task=database.fix
запустите your-site-url.com/administrator/index.php?option=com_installer&task=database.fix
Не помогло, подскажите, что сделать, что бы все заработало наконец то((
не понимаю где эту таблицу найти, в phpMyAdmin все посмотрел нет такой таблицы.
Какой таблицы нет ?
Уважаемые, подскажите пожалуйста. Уже голову сломал за день. После обновления Joomla до 3.9.16 выдает ошибку на главной странице сайта 1054 UNKNOWN COLUMN ‘ENABLED’ IN ‘WHERE CLAUSE’ . Подскажите что делать?
Ну для начала наверное надо включить ошибки на максимум !
Файл /configuration.php
заменяем так
public $error_reporting = ‘development’;
ну и наверное и отладку
public $debug = ‘1’;
И что то должно вывести !!!
Менеджер расширений: База данных
Нажмите «Исправить»
Записан
Чистка сайта от дублей в Яндекс и Google.
Миграция Joomla 1.5 до Joomla 3.хх
Доработка сайта
1054 UNKNOWN COLUMN ‘ENABLED’ IN ‘WHERE CLAUSE’
И это разве все ?
Там что то еще должно быть ! а эта фраза — не полная !
Смотрите в просмотре кода в браузере !
Добрый день! Выдает ошибку ошибка 1054 unknown column a.client id in where clause после обновления
Я не знаю как её исправить. Есть пароль только от админки, а на нее зайти нельзя из-за ошибки, белый экран. Тут говорили про какие-то таблицы, а где их взять? Как исправить?
Спасибо!
Ну для начала наверное надо включить ошибки на максимум !
Файл /configuration.php
заменяем так
public $error_reporting = ‘development’;ну и наверное и отладку
public $debug = ‘1’;И что то должно вывести !
Для начала сделайте это! На страницу должно что то вывести
Записан
Занимаюсь создание расширений для Joomla 3.10.x и 4.2.x | Доработка и настройка сайтов. Занимаюсь создание Интернет магазинов с нуля на собственном компоненте + оптимизация загрузки страницы (после предоставляю техподдержку).
Работа с DOM деревом на PHP
Где это искать и куда вводить? я вообще не шарю в этих штуках
configuration.php
В корне сайта есть файл configuration.php вот таи и ищите $error_reporting и $debug и меняйте значение то что в кавычках
Записан
Занимаюсь создание расширений для Joomla 3.10.x и 4.2.x | Доработка и настройка сайтов. Занимаюсь создание Интернет магазинов с нуля на собственном компоненте + оптимизация загрузки страницы (после предоставляю техподдержку).
Работа с DOM деревом на PHP
А у кого остальные пароли? Неплохо бы к phpmyadmin пароль иметь и к FTP.
Записан
Оказываю услуги по Joomla | Миграция на Joomla 3.x | Сопровождение | IT-аутсорсинг | Недорогие домены и хостинг
1. Background introduction
This is my table:
+-----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+--------------+------+-----+---------+-------+
| na | text | YES | | NULL | |
| birthDate | datetime | YES | | NULL | |
| class | varchar(255) | YES | | NULL | |
+-----------+--------------+------+-----+---------+-------+
This is the code of the task I want to complete (purpose: update Zhang San’s class to Li Si’s):
UPDATE test.student class
SET class = ( SELECT class FROM student WHERE student.na = 'Li Si')
WHERE
student.na = 'Zhang San'
2. Encounter problems, search, solve problems…
1. The first problem encountered-1054:
1054 — Unknown column ‘student.na’ in ‘where clause’
So I cut the code to troubleshoot possible errors
UPDATE test.student class
SET class = 1
WHERE
student.na = 'Zhang San'
I found that the above error still exists. Delete the where clause to execute it. The error message says [‘student.na’ line, unrecognized], I am very puzzled.But when I delete the previous table name «student», the execution is successful!
UPDATE test.student class
SET class = 1
WHERE
na = 'Zhang San'
So I guessed that the update command limits a certain table, and the table name cannot be superfluously added before the column name.
Then I changed the complete code to:
UPDATE test.student class
SET class = ( SELECT class FROM student WHERE na = 'Li Si')
WHERE
na = 'Zhang San'
2. See also error -1093:
1093 — You can’t specify target table ‘class’ for update in FROM clause
It means that you cannot select certain values in the same table first, and then update the table (in the same statement).
That is, you cannot update the value of a field after making a judgment based on the value of a field.
I checked it on the Internet and found that MySQL does not support this kind of operation error, and it is solved by «passing around»
(From: https://zhidao.baidu.com/question/68619324.html)
Option 1:
nest one more layer of subqueries, then delete them,
Option 2:
1. Create a temporary return form, and automatically store the conditions to be deleted in the temporary form:
2. According to the temporary table, delete the main table data:
3. Finally delete the temporary table:
I don’t want to build another table, so I used option one:
UPDATE test.student class
SET class = (SELECT class from( SELECT class FROM student WHERE na = 'Li Si') )
WHERE
na = 'Zhang San'
I nested a layer outside [(SELECT class from(____))]
3. But there is another problem-1248:
(I said, this frustration comes too often, the design is so unintuitive and error-prone, no wonder programmers lose their hair)
1248 — Every derived table must have its own alias
Continue searching…Find the answer: https://blog.csdn.net/cao478208248/article/details/28122113
«This sentence means that each derived table must have its own alias… When performing a nested query, the result of the subquery is used as a derived table To perform the upper level query, so the result of the subquery must have an alias «
So I imitated and added [as t]
UPDATE test.student class
SET class = (SELECT class from( SELECT class FROM student WHERE na = 'Li Si') as t )
WHERE
na = 'Zhang San'
Finally successfully executed!