简体   繁体   中英

how can i use values in array ? (php)

I wanna use values in array of array like:

$result  = $conn->query("SELECT performer,file_id,title,duration FROM 
    databasebot WHERE performer = '$message' or title = '$message'");

$poets = array(
    "keyboard" => array()
);


while ($row = mysqli_fetch_row($result)) {        
    $poets['keyboard'][] = array($row[2],$row[1]);         
}

I wanna echo $poets values of $row[1]. How can I do that?

Loop through the array in $poets['keyboard'] . In each element, $poets[1] will be in the [1] sub-element.

foreach ($poets['keyboard'] as $kb) {
    echo $kb[1];
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM