使用SQL查询的PHP中的内存错误

I have a PHP page that has a search box and searches media from a fairly large database. I have made it so that if you only put the first 3 characters (e.g. V75) all the V75 tapes are shown (V75000, V75001, etc.). However when I search just V7 it gives me this error:

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 47 bytes) on line 68

    $query->execute(); // LINE 66

    $result = $query->fetchAll(PDO::FETCH_ASSOC); // LINE 68
    }catch (Exception $e) // LINE 69
    {
    die('Cant fetch rows.'); // LINE 70

I was wondering what I must change for it to display the V7 tapes as well?
The approximate number of 'V7' tapes is 255000

Note that, even if you set the PHP memory limit higher to allow for this many results, sending more than 256 MB to the user for a search query will make the request terribly slow if it doesn't even time out.

Use some sort of pagination and limit your queries.