Get rows from the result set and free the result memory:
mysqli_fetch_array()
<?php // Assume database username: root, password: 123456, database: CODERCTO $con = mysqli_connect ( " localhost " , " root " , " 123456 " , " CODERCTO " ) ; if ( mysqli_connect_errno ( $con ) ) { echo " Failed to connect to MySQL: " . mysqli_connect_error ( ) ; } $sql = " SELECT name,url FROM websites ORDER BY alexa " ; if ( $result = mysqli_query ( $con , $sql ) ) { // Get line by line while ( $row = mysqli_fetch_row ( $result ) ) { printf ( " %s : %s " , $row [ 0 ] , $row [ 1 ] ) ; echo " <br> " ; } // Release the result set mysqli_free_result ( $result ) ; } mysqli_close ( $con ) ; ?> Definition and usage
The mysqli_free_result() function frees the result memory.
grammar
mysqli_free_result( result ) ;
parameter | describe |
---|
result | Required. Specifies the result set identifier returned by mysqli_query(), mysqli_store_result(), or mysqli_use_result(). |
technical details
Return value: | There is no return value. |
---|
PHP version: | 5+ |
---|