Ansel_Tk1 Posted January 23, 2007 Share Posted January 23, 2007 Hi all - wondering if someone could point me in the right direction!Trying to create a recordset that takes into account the value of a session variable. Basically it says - SELECT from this table, these columns and IF {SESSION.user_franchise_code} has a value of '1', show all the records in the table. Otherwise, select the records WHERE column 'map_franchise_code' is equal to that of {SESSION.user_franchise_code}. Wow I hope that makes sense.any help would be really appreciated.... Quote Link to comment https://forums.phpfreaks.com/topic/35295-query-with-session-variable-any-help-would-be-appreciated/ Share on other sites More sharing options...
bibby Posted January 23, 2007 Share Posted January 23, 2007 Use PHP to decide which query to run based on that session var.Mysql has IFs built in, but it relates to data in (or not in) the table, knowing nothing of your vars. Quote Link to comment https://forums.phpfreaks.com/topic/35295-query-with-session-variable-any-help-would-be-appreciated/#findComment-166977 Share on other sites More sharing options...
Ansel_Tk1 Posted January 23, 2007 Author Share Posted January 23, 2007 Hi - thank you - is there any chance you could show me an example?Thank you so much! Quote Link to comment https://forums.phpfreaks.com/topic/35295-query-with-session-variable-any-help-would-be-appreciated/#findComment-167234 Share on other sites More sharing options...
Ansel_Tk1 Posted January 25, 2007 Author Share Posted January 25, 2007 Anyone? I am just having a hard time understanding where the php would go to decide which query should be run.Any help would be appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/35295-query-with-session-variable-any-help-would-be-appreciated/#findComment-169046 Share on other sites More sharing options...
fenway Posted January 25, 2007 Share Posted January 25, 2007 You'll have to build the where clause dynamically. Quote Link to comment https://forums.phpfreaks.com/topic/35295-query-with-session-variable-any-help-would-be-appreciated/#findComment-169055 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.