راکت

مشکل در دستورات شرطی if

1 پاسخ

سلام وقت بخیر میخواستم بدونم که چطور میشه یک دستور شرطی رو داخل یک دستور شرطی اصلی نوشت
من قصد دارم که در یک دستور شرطی یک رکورد در جدول استخراج کنم که باید از if استفاده کنم فکر نکنم راهی باشه جز این
اگر بلدین لطفا کمک کنین

function detect_command_and_reply() {

        $text = $GLOBALS['text'];

        $str = substr($text, 0, 5);

        if($str == '/edit'){ 
            $product_id = substr($text, 5, strlen($text));

                $text         = $GLOBALS['text'];          // پیام دریافتی از کاربر
        $text_replied = $GLOBALS['text_replied']; 
    $sy = $GLOBALS['text'];

         $product_id = strtok($text_replied, "\n");
        $noee = $GLOBALS['text'];

                $chat_id = $GLOBALS['chat_id'];
                $connection = connect_to_db();
                $connection -> query("UPDATE user SET tf='true3' WHERE id=$product_id");
                $connection -> close();

                   $connection = connect_to_db();

        $result = $connection -> query("SELECT * FROM `user` WHERE id = $product_id");
        if($row = $result -> fetch_assoc()) {

            $id = $row['id'];
            $vaze = $row['vazeiyat'];

            $reply =  "تایید";
            $url = $GLOBALS['bot_url'] . "/sendMessage";
            $post_params = [ 'chat_id' =>  $GLOBALS['chat_id'] , 'text' => $reply];
            send_reply($url, $post_params);
            backmenu();
            }  

        }    

        }
amir jafari
amir jafari
@sharkbeat
ثبت پرسش جدید

پاسخ‌ها

1
سید امییرضا موسوی خسروی
سید امییرضا موسوی خسروی
@amirrezamcp

تخصص: php

مشکلت رو واضح تر بیان کن

شاید پاسخ شما همین‌جا باشد

برای ارسال پاسخ لازم است وارد شده یا ثبت‌نام کنید

ورود یا ثبت‌نام