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 Link to comment https://forums.phpfreaks.com/topic/118664-any-help-with-sql-statement-would-be-appreciated/ 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. Link to comment https://forums.phpfreaks.com/topic/118664-any-help-with-sql-statement-would-be-appreciated/#findComment-611046 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.