0

User fills out a web form containing about a dozen or so combo boxes. As each comboBox has its options filled from values contained in a database, this limits what the user can input. However, as we know this can be bypassed, hence the need for validation even on a preset data set. So after I've "cleaned" the input, I need to make sure the values are valid before adding a new row into the database.

Currently, I'm thinking of just doing the following (except with 17 tables):

SELECT * FROM t1,t2,t3 WHERE t1.id = '{$clean['a']}' AND t2.id = '{$clean['b']}' AND t3.id = '{$clean['c']}'

How efficient would that be? Or would there be a better way? This isn't a query ran on every page, only during registration. And though this wouldn't tell me which field is invalid, it would tell me if all values are contained in the database and thus valid or not.

Edited by Phaelax: n/a

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Phaelax
0

You are correct, the id is just an auto-incremented tinyint. I'm assuming accessing all these tables at once would be better than making multiple queries to check for each one individually.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.