R
R
Roman Savitsky2017-02-10 19:47:01
Yii
Roman Savitsky, 2017-02-10 19:47:01

By changing the name of the plate in the php file models to the same in the database, the posts are no longer displayed?

Good afternoon everyone!
There is a working donor site on Yii2, the News module was created, php files for adding and editing news from the aminka, and displaying them on the site
In the model file, in this block

public static function tableName()
    {
        return 'brk_statji'; //news
    }

I replaced the name of the table with the similar one in the brk_statji database, there are posts in the table, but it gives the
An internal server error occurred database error.
The above error occurred while the Web server was processing your request.
Please contact us if you think this is a server error. thank you.
I did not touch the logic, only changed the name of the table.
Yii2 - продолжает делать MySQL - запрос все равно в таблицу news

Why swears, what are the pitfalls?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2017-02-10
@slo_nik

Good evening.
"brk" is a table prefix?
If yes then try this

public static function tableName()
    {
        return '{{%statji}}'; //news
    }

And where is this table located, in the same database or another one?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question