Reputation: 11478
Is it possible to get around mysql_unbuffered_query()'s limitation of having one query running at a time by opening a second connection?
For example, the following code is giving me the error:
mysql_select_db(): Function called without first fetching all rows from a previous unbuffered query
$feedData = mysql_unbuffered_query($sql, $this->_unbufferedDbManager->db->connection);
while ($record = mysql_fetch_assoc($feedData)) {
File::fputcsv($this->_fileHandle, $record, $this->delimiter, $this->enclosure);
$sql = "UPDATE transactions
SET feed_transmit_date = '$this->today'
WHERE transaction_id = " . $record['transaction_id'];
$this->dbManager->DbQuery($sql);
print_r($this->_unbufferedDbManager->db->connection);
print_r($this->dbManager->db->connection);
}
The two print_r()'s at the end output: Resource id #637Resource id #639
DbManager is an old pear data access layer
Note: I would have used a mysql_unbuffered_query tag, but I recently opened a bounty that put me below the "create new tags privilege."
Upvotes: 2
Views: 1371
Reputation: 5340
On PMV's suggestion I'm writing this answer. In summary, it was an issue of the different database classes using the same connection even though they reported different resource ids. See the question's comments for more.
Upvotes: 2