MYSQL - Select specific value from a fetched array

后端 未结 9 1447
青春惊慌失措
青春惊慌失措 2021-01-06 01:45

I have a small problem and since I am very new to all this stuff, I was not successful on googling it, because I dont know the exact definitions for what I am looking for.

9条回答
  •  一向
    一向 (楼主)
    2021-01-06 02:40

    If you would rather work with a full set of results instead of looping through them only once, you can put the whole result set to an array:

    $row = array();
    
    while( $row[] = mysql_fetch_array( $result ) );
    

    Now you can access individual records using the first index, for example the name field of the second row is in $row[ 2 ][ 'name' ].

提交回复
热议问题