S
S
Svetlana Galenko2018-11-18 20:35:29
Yii
Svetlana Galenko, 2018-11-18 20:35:29

SQLSTATE[HY000]: General error: 1364 Field 'img_name' doesn't have a default value?

Hello, I transferred the database from LAN to hosting, but when I try to call any value, for example, from the admin panel: add news, this error pops up:
5bf1a481d2f62962412836.png
Everything works on LAN, but not on hosting, I checked the transferred database from LAN to hosting, everything is written like this the same as on the LAN and nothing broke, that is, everything that is needed was transferred along with the auto increment
. Please tell me what caused this error?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2018-11-18
@swallow_97

Good evening.
The 'img_name' field must have a default value.
Or change the default value in the table or decide through validation.

public function rules()
{
    return [
       ['img_name', 'default', 'value' => 0]
    ]
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question