Answer the question
In order to leave comments, you need to log in
How to make the right query?
Here is the code:
while($cal = $sqlotv->fetch_array()) {
if($cal['user_id'] == $user_id) {
exit();
} else {
if(mb_strtolower($body) == '!старт' || mb_strtolower($body) == '!поиск') {
$sqlotvin = $mysqli->query(" INSERT INTO `anon_chat` (`id_group`, `user_id`, `sex`, `user_id2`) VALUES ('".$group_id."', '".$user_id."', '".$sex."', '".$cal['user_id']."') ");
$sqlotvup = $mysqli->query(" UPDATE `anon_chat` SET `user_id2` = '".$user_id."' WHERE `stop` = '0' LIMIT 1"); // Добавляем id к свободному пользователю
$sqlotvups = $mysqli->query(" UPDATE `anon_chat` SET `user_id2` = '".$cal['user_id'] ."' WHERE `user_id` = '".$user_id."' AND `stop` = '0' LIMIT 1");
$message = urlencode('Собеседник найден! Подключаю...');
$url = json_decode(file_get_contents("https://api.vk.com/method/messages.send?message={$message}&user_ids={$user_id},{$cal['user_id']}&access_token={$token_message}&v={$v}"));
}
}
}
$user_id
to a free user_id2
user in the field who has stop = 0
, and then add the same user to another user_id2
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question