mysql_unbuffered_query( )

Use this PHP function to execute a MySQL statement given without buffering the results so that you can retrieve the data from MySQL without having to wait for the results set to be completed.

Syntax

resource mysql_unbuffered_query(sql_statement[, connection])

Explanation

Use this PHP function to execute a MySQL statement given without buffering the results so that you can retrieve the data without having to wait for the results set to be completed. An identifier may be given as a second argument to the function to interface with a different connection. This PHP function returns false if the query is unsuccessful. For MySQL statements that would not return a results set based on their nature (e.g., INSERT), true is returned when the function is successful. This function should be used with care, because an enormous results set could overwhelm the program's allocated memory.

Examples

...
$sql_stmnt = "SELECT wrid, client_name, description
              FROM workreq, clients
              WHERE workreq.clientid = clients.clientid";
$results = mysql_unbuffered_query($sql_stmnt, $connection);
while($row = mysql_fetch_row($results)) {
  print "WR-$row[0]: $row[1] - $row[2] \n";
}
...

There's no difference in the syntax for mysql_unbuffered_query() and mysql_query( ), nor in the handling of the results. The only differences in this function are the speed for large MySQL databases and the fact that functions such as mysql_num_row( ) and mysql_data_seek() cannot be used, because the results set is not buffered and therefore cannot be analyzed by these functions.