R
R
rartg2018-07-10 18:58:58
MySQL
rartg, 2018-07-10 18:58:58

Error (#8) Yii2, what could be the problem?

I wrote a site on Yii2 on a virtual machine, everything works fine, when uploading to the network, such a problem arose. There is a database with tables, one is purely text of several fields, the rest are text + photo.
The first table is displayed and displayed without any problems, when switching to other tabs where there is a table, it hits an Error (# 8) error, does anyone know a solution to the problem? Thanks in advance.
Database connection code

<?php

return [
    'class' => 'yii\db\Connection',
    'dsn' => 'mysql:host=localhost;dbname=yii2raspisanie',
    'username' => 'zimudar',
    'password' => '123',
    'charset' => 'utf8',

    // Schema cache options (for production environment)
    //'enableSchemaCache' => true,
    //'schemaCacheDuration' => 60,
    //'schemaCache' => 'cache',
];

Controller Code
<?php
namespace app\controllers;
use Yii;
use yii\filters\AccessControl;
use yii\web\Controller;
use yii\web\Response;
use yii\filters\VerbFilter;
use app\models\LoginForm;
use app\models\ContactForm;
use app\models\Yii2raspisanie;
use app\models\Comtact;
use app\models\Lecturers;
use app\models\Partners;
class SiteController extends Controller
{
    /**
     * {@inheritdoc}
     */
    public function behaviors()
    {
        return [
            'access' => [
                'class' => AccessControl::className(),
                'only' => ['logout'],
                'rules' => [
                    [
                        'actions' => ['logout'],
                        'allow' => true,
                        'roles' => ['@'],
                    ],
                ],
            ],
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'logout' => ['post'],
                ],
            ],
        ];
    }

    /**
     * {@inheritdoc}
     */

    public function actions()
    {
        return [
            'error' => [
                'class' => 'yii\web\ErrorAction',
            ],
            'captcha' => [
                'class' => 'yii\captcha\CaptchaAction',
                'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null,
            ],
        ];
    }

    /**
     * Displays homepage.
     *
     * @return string
     */
    public function actionAboutcompany(){
      $lecturers = Lecturers::find()->orderBy('id DESC')->all();
        $partners = Partners::find()->orderBy('id DESC')->all();
      return $this->render('aboutcompany', compact('lecturers','partners'));


      }
      /**
       * Displays homepage.
       *
       * @return string
       */
      public function actionPartners(){
        $partners = Partners::find()->orderBy('id DESC')->all();
        return $this->render('partners', compact('partners'));
        }
    /**
     * Displays homepage.
     *
     * @return string
     */
    public function actionIndex()
    {
      $posts = Yii2raspisanie::find()->select('id,month,date,text')->orderBy('id DESC')-> limit(3) ->all();
      return $this->render('index', compact('posts'));
    }
    /**
     * Displays about page.
     *
     * @return string
     */
    public function actionAbout()
    {
      $posts1 = Comtact::find()->orderBy('id DESC')->all();
      //$this->debug($posts);
      //debug($posts1);
      return $this->render('about', compact('posts1'));
    }


    /**
     * Login action.
     *
     * @return Response|string
     */
    public function actionLogin()
    {
        if (!Yii::$app->user->isGuest) {
            return $this->goHome();
        }

        $model = new LoginForm();
        if ($model->load(Yii::$app->request->post()) && $model->login()) {
            return $this->goBack();
        }

        $model->password = '';
        return $this->render('login', [
            'model' => $model,
        ]);
    }

    /**
     * Logout action.
     *
     * @return Response
     */
    public function actionLogout()
    {
        Yii::$app->user->logout();

        return $this->goHome();
    }

    /**
     * Displays contact page.
     *
     * @return Response|string
     */
    public function actionContact()
    {
        $model = new ContactForm();
        if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
            Yii::$app->session->setFlash('contactFormSubmitted');

            return $this->refresh();
        }
        return $this->render('contact', [
            'model' => $model,
        ]);
    }



    public function actionExpertise()
    {
    return $this->render('expertise');
 }
 public function actionQualification()
 {
 return $this->render('qualification');
}




public function actionFormcont()
{
return $this->render('formcont');
}
}

?>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rartg, 2018-07-10
@rartg

It's also worth images costarico removed the output of images, it worked, but again, a new question is how to display images now:?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question