Ansel_Tk1 Posted August 7, 2008 Share Posted August 7, 2008 Hi - I am trying to contstruct a statement that does this: SELECT * FROM galleries WHERE gallery_id = %s OR ct_page ='photos' AND gallerypublish = 1 ORDER BY gallerydate DESC What I was trying to do: if no value is plugged in to %s via the URL, then no records are returned. In that case, the OR should return values based on whether the field contains the word 'photos'. Obviously, it don't work. Could someone suggest the proper operation to use here? Thanks Quote Link to comment Share on other sites More sharing options...
fenway Posted August 7, 2008 Share Posted August 7, 2008 You need to build you where clause dynamically in php. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.