Answer the question
In order to leave comments, you need to log in
Checking for the same RedBeanPhp value?
I need help. How to check for same value in mysql table? For example, I have a $chat_id variable that always changes its value, and when the user enters a certain command, the chat id gets into the database, and I need the chat id value not to be recorded again. In other words, check for the same Chat-Id. I just started to do it, but for some reason it does not work, can you help me fix it?
$book = R::findOne('newchat', 'chat_id = ?', array([$chat_id]));
if ( $book ) {
//чат-ид существует
if ($chat_id = $user->chat_id) {
//если чат-ид совпадает, то нужно выдать сообщение
$suc = 'Успешно';
} else {
$error = 'Ошибка';
}
}
$chat_id = $result['message']['chat']['id'];
Answer the question
In order to leave comments, you need to log in
if ($chat_id = $user->chat_id) {
Is assignment necessary here? Maybe that's why it doesn't work?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question