0

I have one telegram code with sendMessage Method with text and keyboard. Its for finding music.

My code is:

$res_media=mysql_query("SELECT * FROM mv_media");
if(mysql_num_rows($res_media)!=0){
    while($resualt_media = mysql_fetch_assoc($res_media)) {
        $media[][]= $resualt_media['title'];
    }
    var_dump(
        makeHTTPRequest('sendMessage',[
            'chat_id'=>$chat_id,
            'text'=>"Chose music.",
            'reply_markup'=>json_encode(array('keyboard' => $media))
        ])
    );
}

and output:

image description

I want custom output How can i add some field to keyboard with while my database output ($media) :

$media=[['Button1'],['Button4']];

This is from database with while , now how add custom field to $media. I want this output:

$media=[['Button1'],['Button4'],['MyCustomButtonForExampleBack']]
Syfer
  • 4,262
  • 3
  • 20
  • 37
amir ntm
  • 84
  • 8

2 Answers2

0

You have some problems in request, check out API document, and following example:

Awesome Telegram Bot

Sean Wei
  • 7,433
  • 1
  • 19
  • 39
0

Use

array_chunk($media, 4)

where 4 is the number of buttons in the row.

RaminS
  • 2,208
  • 4
  • 22
  • 30
ozo
  • 19
  • 1