Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a telegram bot in php and a while that has to do about 3000 rounds. At some point the while freezes until I write to the bot any character

'''$query0 = "SELECT * FROM admintable WHERE chatid LIKE '161200987'";

if ($result = mysqli_query($link, $query0)){}
    
        while($row=mysqli_fetch_array($result)){
            
            $st=$row[stato];
            
        }
    
    
        while($st=="mandando"){
        
        
            $query200 = "SELECT * FROM `RisparmioEasyGiftBot` where page = 'invia'";
            $result=mysqli_query($link, $query200);
            
            
        
            while($row=mysqli_fetch_array($result)){
            
                
                $ch=$row[chat_id];
                $page=$row[page];
                $c=$c+1;
                sendMessage($ch, "f");
                $query2 = "UPDATE `RisparmioEasyGiftBot` SET `page`= '' WHERE chat_id = ".$ch."";
                sendMessage(161200987, "mandato a $ch");
                $result=mysqli_query($link, $query2); 
                $text=$text;
                
            }
            $query200 = "SELECT * FROM `RisparmioEasyGiftBot` where page = 'invia'";
            $result=mysqli_query($link, $query200);  
        
            $query22 = "SELECT COUNT(*) FROM `RisparmioEasyGiftBot` WHERE `page` LIKE 'invia'";
    
            if ($result = mysqli_query($link, $query22)){
    
                $row=mysqli_fetch_array($result);
        
                if($row[0]==0){
            
                $query23 = "UPDATE `admintable` SET `stato`= '' WHERE chatid = ".$chatid."";
                $result=mysqli_query($link, $query23); 
            
            }
        }  
    }



if ($result = mysqli_query($link, $query0)){}
    
    while($row=mysqli_fetch_array($result)){
            
        $st=$row[stato];
        
        
    }'''
        

    
question from:https://stackoverflow.com/questions/65649250/while-loop-problems-with-telegram-bot

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
182 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...