Add if clause to send warning if more than one user points to a user.

This commit is contained in:
Ceda EI 2018-04-04 16:13:55 +05:30
parent df78a02d3e
commit 229a343ebd
1 changed files with 10 additions and 0 deletions

View File

@ -33,6 +33,16 @@ function get_chain_from_user($user) {
while (true) {
$query = "SELECT user_id, username from users where follows = $last_user_id ;";
$result = $conn->query($query);
if ($result->num_rows > 1) {
$text = "Chain is unstable. The following users are pointing to ";
$op = $conn->query("select username from users where user_id = $last_user_id;");
$text .= $op->fetch_assoc()['username'] . "\n";
while ($row = $result->fetch_assoc()) {
$text .= '@' . $row['username'] . "\n";
}
send_text($text);
mysql_data_seek($result, 0);
}
if ($result->num_rows > 0){
# Code executed if this isn't the last user
$details = $result->fetch_assoc();