0
<?php
    $res_best=mysql_query("SELECT * FROM best");
    $best=array();
    while($best=mysql_fetch_assoc($res_best)){
        $best['username'];
    }
    var_dump(
        makeHTTPRequest('sendMessage',[
            'chat_id'=>$chat_id,
            'text'=>$best
        ])
    );
?>

I want save while in variable and use this variable in var_dump for telegram bot. how can i use this while for text?

amir ntm
  • 84
  • 8
  • 1
    While this won't fix your problem, please note the `mysql_` constructor is [**deprecated as of PHP 5.5**](https://wiki.php.net/rfc/mysql_deprecation), and is [**removed in PHP 7**](https://wiki.php.net/rfc/remove_deprecated_functionality_in_php7#extmysql). Please consider switching to either [**MySQLi**](http://php.net/manual/en/book.mysqli.php) or [**PDO**](http://php.net/manual/en/book.pdo.php), ensuring that you also use [**prepared statements**](http://php.net/manual/en/mysqli.quickstart.prepared-statements.php) to prevent [**SQL injection**](https://en.wikipedia.org/wiki/SQL_injection) :) – Obsidian Age Oct 25 '17 at 23:22
  • `var_dump()` is for debugging, it's not generally useful in applications. – Barmar Oct 26 '17 at 00:40
  • What is the line `$best['username'];` supposed to do? – Barmar Oct 26 '17 at 00:40
  • 1
    You should probably put the `makeHTTPRequest()` call inside the `while` loop. – Barmar Oct 26 '17 at 00:45

0 Answers0