Processing empty fields from a form - PHP
Posted: Tue Oct 05, 2004 5:00 pm
Didn't know where exactly to put this, but here it goes:
If I have two fields in a form that I use to search DB, and user inputs something into the first, and nothing to the second (first case - he clicked in it and just passed by it, nothing was inputed; and in the second case he didn't even touched the field)
Is anything passed to php (with POST and/or GET methods) ?
I ask this because my mysql_query look's like this
SELECT *
FROM TABLE 1
WHERE col1 = "$input_field1" and col2 = "input_field2";
So my question is - will this (empty "value") field slow down my query, because (I think, but not sure - so I ask
) the value is empty - mysql will search trough the entire column.
And this gets more complicated (ouch my sleepy brain wants to get out of my creasy head) if I do EXPLODE in php before the query (of course I also TRIM it before querying).
Thanks in advance for the reply.
If I have two fields in a form that I use to search DB, and user inputs something into the first, and nothing to the second (first case - he clicked in it and just passed by it, nothing was inputed; and in the second case he didn't even touched the field)
Is anything passed to php (with POST and/or GET methods) ?
I ask this because my mysql_query look's like this
SELECT *
FROM TABLE 1
WHERE col1 = "$input_field1" and col2 = "input_field2";
So my question is - will this (empty "value") field slow down my query, because (I think, but not sure - so I ask
And this gets more complicated (ouch my sleepy brain wants to get out of my creasy head) if I do EXPLODE in php before the query (of course I also TRIM it before querying).
Thanks in advance for the reply.