Skip to content

SQLSTATE[HY093]: Invalid parameter number' in ConversationDB.php #598

@rampapampapampapam

Description

@rampapampapampapam

Required Information

  • Operating system: Mac OS
  • PHP version: 5.6.30
  • PHP Telegram Bot version: 0.47.1
  • Using MySQL database: yes
  • MySQL version: 5.6.35
  • Update Method: Webhook
  • Self-signed certificate: yes
  • RAW update (if available):

Expected behaviour

When creating a new conversation i get error.
SQLSTATE[HY093]: Invalid parameter number' in /Users/kruteevgrigoryalexandrovich/Git/videofirma/analytics/bot/vendor/longman/telegram-bot/src/ConversationDB.php:108

Actual behaviour

Its work after change in ConversationDB.php

from

            $sth    = self::$pdo->prepare('INSERT INTO `' . TB_CONVERSATION . '`
                (
                `status`, `user_id`, `chat_id`, `command`, `notes`, `created_at`, `updated_at`
                )
                VALUES (
                :status, :user_id, :chat_id, :command, :notes, :date, :date
                )
               ');
            $active = 'active';
            $notes  = '[]';
            $created_at = self::getTimestamp();

            $sth->bindParam(':status', $active);
            $sth->bindParam(':command', $command);
            $sth->bindParam(':user_id', $user_id);
            $sth->bindParam(':chat_id', $chat_id);
            $sth->bindParam(':notes', $notes);
            $sth->bindParam(':date', $created_at);

to

            $sth    = self::$pdo->prepare('INSERT INTO `' . TB_CONVERSATION . '`
                (
                `status`, `user_id`, `chat_id`, `command`, `notes`, `created_at`, `updated_at`
                )
                VALUES (
                :status, :user_id, :chat_id, :command, :notes, :date1, :date2
                )
               ');
            $active = 'active';
            $notes  = '[]';
            $created_at = self::getTimestamp();

            $sth->bindParam(':status', $active);
            $sth->bindParam(':command', $command);
            $sth->bindParam(':user_id', $user_id);
            $sth->bindParam(':chat_id', $chat_id);
            $sth->bindParam(':notes', $notes);
            $sth->bindParam(':date1', $created_at);
            $sth->bindParam(':date2', $created_at);

Steps to reproduce

Extra details

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions