I am creating a PHP application for my company and I am using about 50+ checkboxes to allow the user to select what parts of the table they want to pull. However, right now, if the user selects a checkbox that has a corresponding SQL column name that is NOT in the table, there is no handle (it only returns 0 columns). Is there a way to handle this kind of problem easily? Thanks
Share
I wouldn’t give the users options that are not available, in the first place.
But if you want to check a table structure in SQL, use
DESCRIBE tablenameas a query, then loop through the results looking at columnField. You should do that before constructing the SQL query that will get your actual data, so you don’t reference any non-existent columns.