Building SQL queries - is there an easier way?
Posted: Fri Sep 19, 2008 11:24 am
Hi all.
I've been struggling with writing a script to query a mysql table by lots of different criteria - generating SQL like this:
SELECT field1, field2, field3, field4, field5 FROM table1 WHERE field4>6 AND field5='value1' ORDER BY field1 DESC LIMIT 0,10
depending on form input.
Is there a class out there that makes this any easier? At the moment I've got about 200 lines of code that aren't reusable for anything else.
Does anyone think a class would help matters, or would it be pointless?
Yours interestedly,
deafpanda
I've been struggling with writing a script to query a mysql table by lots of different criteria - generating SQL like this:
SELECT field1, field2, field3, field4, field5 FROM table1 WHERE field4>6 AND field5='value1' ORDER BY field1 DESC LIMIT 0,10
depending on form input.
Is there a class out there that makes this any easier? At the moment I've got about 200 lines of code that aren't reusable for anything else.
Does anyone think a class would help matters, or would it be pointless?
Yours interestedly,
deafpanda