php-telegram-bot / core

PHP Telegram Bot based on the official Telegram Bot API
MIT License
3.79k stars 949 forks source link

PDOStatement::execute(): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'bot.telegram_update' doesn't exist #1415

Closed iyamk closed 8 months ago

iyamk commented 9 months ago

/home/user/bot/vendor/longman/telegram-bot/src/DB.php Line 233 Error: PDOStatement::execute(): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'bot.telegram_update' doesn't exist My code:

try {
    $telegram = new Longman\TelegramBot\Telegram($bot_api_key, $bot_username);

    $telegram->addCommandsPaths([
        __DIR__.'/Commands'
    ]);

    $mysql_credentials = [
   'host'     => 'localhost',
   'port'     => 3306,
   'user'     => 'root',
   'password' => '',
   'database' => 'bot'
    ];

    $telegram->enableMySql($mysql_credentials);

    $telegram->handleGetUpdates();
}
catch (Longman\TelegramBot\Exception\TelegramException $e)
{
    writeLog($e->getMessage());
}

What is it and where can I get a database dump?

jacklul commented 9 months ago

https://github.com/php-telegram-bot/core/blob/develop/structure.sql

iyamk commented 8 months ago

https://github.com/php-telegram-bot/core/blob/develop/structure.sql

How tired I am of this structure already; was it really impossible to do without it? The code works just as quickly both with and without it