K
K
k0smos2020-09-19 13:12:37
PHP
k0smos, 2020-09-19 13:12:37

How in this case to select only the necessary user from a DB?

Good afternoon.
Implemented an application system for the tg bot, here is a piece of the application generator code:

elseif($bd_user['lap'] == 2)
{
    $data_bd = json_decode($bd_user['data'], true);
    $data_bd['w'] = $text;
    
    $sth = $db->prepare("UPDATE `user` SET `data` = '', `lap` = '', `stage` = '' WHERE `tg_id` = :tg_id");
    $sth->execute(array('tg_id' => user_chat_id()));
    $array_user = $sth->fetch(PDO::FETCH_ASSOC);
    
    $mess = "У нас новая заявка в шопе!\n\n Юзер: @".$bd_user['tg_username']."\nВопрос 1: <code>".$data_bd['s']."</code>\nВопрос 2: <code>".$data_bd['e']."</code>\n Вопрос 3: <code>".$data_bd['w']."</code>";
    
    send_tg_text_priv($mess, inline_button_invite_admin(), $config['chat']['admin']);
    
    $okay = "Ожидайте ответа!";
    
    send_tg_text($okay, button_1());   

}

As you can see, the text is sent to the administrator with inline buttons: "add" and "delete", let's say the file is attached to add:
$sth = $db->prepare("SELECT * FROM `user` WHERE `tg_id` = :tg_id");
    $sth->execute(array('tg_id' => user_chat_id()));
    $bd_user = $sth->fetch(PDO::FETCH_ASSOC);

if($bd_user['status'] == 2)
{

}
else
{
    exit;        
}

Here, in fact, is the problem, how to select a user in the inline button activator? When the bot sends the log to the admin, how to catch it later and find it, for example , in another file. There is not enough knowledge of theory, I did not find information on the Internet. (I would be grateful for advice Юзер: @".$bd_user['tg_username']."

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question