php while while循环在获取结果行时莫名其妙地失败

So I'm having a very strange issue and am not quite sure what to think about it...

I have a standard database query doing a select on a table. It returns a resource, num_rows = 101, and it will fetch rows up to row 42 at which point it simply stops all script execution, no errors, not timing out (takes less than a sec to get the 42 rows) ... I can't provide a link but here's the code in question...

$select2 = "SELECT * FROM `$dbname`.`$file" . "_settings` WHERE `weight` <> 0 ORDER BY `count` ASC";
$result = mysql_query($select2);
$lpcnt = 0;
$numrows = mysql_num_rows($result);
while ($display = mysql_fetch_array($result, MYSQL_ASSOC)){
    /* This will print out 42 times */
    echo '<pre>In The LOOP, row('.$lpcnt.'):<br>NumRows: '.$numrows.'<br>';
    print_r($display);
    echo '</pre><br/>';
    $domRows[] = $display;
    $aTotal[] = $display['count'];
    $aTotWeight[] = $display['weight'];
    //debug vars
    $d['url'] = $display['url'];
    $d['total'] = $total;
    $d['count'] = $display['count'];
    $d['weight'] = $display['weight'];
    $dbug['domRows'][] = $d;
    $lpcnt++;
}
/* Never Reaches this */
echo '<pre>';die(print_r('Loop Finished'));

At a loss as to what's causing the failure midway through the results loop...

also..I know, I know...myql_ is depreciated, but's that's what I have to work with!

Thanks in advance for any light anyone can shed...this is really hurting the site!

EDIT: also this doesn't break all the time, so far it seems to be related somehow to the number of results...for example, if I run through a result set that has 39 rows, it will proccess all of them...and it's consitently failing at 42 rows... on my tables that have 100+ records

EDIT FINAL: Ok figured it out! Turns out we had our memory limit to low, so it was trying to allocate an illegal amount of memory! So we upped it and now it works! Also I had my error reporting in a spot where it was being conditionally turned back off by other code...that's why I wasn't seeing errors! Duh... anyway, thanks for the stabs, to those that responded Merry x-mas and all that jazz...