Windows 7 SP1; php 5.3.29; Apache 2.4.9; MySQL 5.6.17 $isr = mysql_unbuffered_query ( $is, $link_id ); if ($isr === false) { ... } if ($isr) { $booking_id = ''; while ( $isv = mysql_fetch_assoc ( $isr ) ) { $result ['id'] = $isv ['id']; ... Second time through this loop I get the following error: Warning: mysql_fetch_assoc(): 40 is not a valid MySQL result resource in C:\Users\Mark Murphy\whiworkspace\spur\cron\import_bookings.php on line 89 Problem is that for the resource, the type is changed to Unknown by a different mysql_query within the loop. Any idea what will cause this? When the statement works, the debug value for $isr is resource id='40' type='mysql result'. When the statement fails, the debug value if resource id='40' type='Unknown'