This function Send an SQL query to MySQL, without fetching and buffering the result rows.

Unlike mysql_query(), this function does not fetch and buffer the recordset automatically. This saves some memory with large SQL queries, and you can start working on the result set immediately after the first row has been retrieved.

Syntax: mysql_unbuffered_query(query,connection)

Description:
The first argument “query” is Required. It specifies the SQL query to send (should not end with a semicolon).

The second argument “connection” is Optional. It Specifies the MySQL connection. If not specified, the last connection opened by mysql_connect() or mysql_pconnect() is used.

This function returns the query handle for SELECT queries, TRUE/FALSE for other queries, or FALSE on failure.

Note: The benefits of mysql_unbuffered_query() come at a cost: You cannot use mysql_num_rows() and mysql_data_seek() on a result set returned from mysql_unbuffered_query().

Example:
Code:

$con = mysql_connect("localhost","mysql_user","mysql_pwd");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }


$sql = "SELECT  * FROM companydata";

mysql_unbuffered_query($sql,$con);


mysql_close($con);
eXTReMe Tracker