Answer the question
In order to leave comments, you need to log in
How to perform sequential write to mysql via telegram bot (php-telegram-bot)?
Hello! I am studying php and mysql, trying to make a telegram bot.
I decided to use the php-telegram-bot (longman) library , but there was a problem, I can’t figure out how to carry out a dialogue with the bot like:
me: /command
bot: enter the name (at this stage, the id, date and name are written to the mysql table)
I : bot name
:
enter text (write text on the same line where you wrote the name)
me: text
How to do it?
I already tried to write to the database with two separate commands for the bot, the first one writes the id, date and name, and the second one should add text to the same line using the UPDATE sql query, but in order to use update, you need to specify which row in the table you need to change. Thanks in
advance :)
Answer the question
In order to leave comments, you need to log in
To do this, you need to create another field “WaitingForAnsweringQuestion” for users in the database and, when he enters command1, write something to the database, set “WaitingForAnsweringQuestion” to 1. Before processing commands, check whether this field is equal to one, and , if equal - I think you understand - it will be an addition. After appending, return the field to 0.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question