Custom fields now displaying as table columns in search results
My first difficult major objective is now achieved: custom fields, like other fields in the table, now have "Show" checkboxes next to them, and you can select them and have them show up in the table of search results just like regular fields.
This is quite a costly operation, because it means you have to retrieve all the custom field data from the database for each regular record that you're retrieving, but I've done my best to mitigate this by making sure it only happens if it's needed; you only retrieve the custom field data if you've elected to display at least one custom field, and if you aren't displaying any, even if you're using one or more as a search parameter, they still aren't retrieved. Nevertheless, I wish it would go a bit faster. It's difficult to know how that could be done, though, without hand-optimizing SQL union queries, which undermines the class-based structure of my PHP objects. Since custom fields are only used in JW's project, though, it's not too crucial.
Now I can move on to the requirement for spreadsheet output.