sania Posted June 1, 2007 Share Posted June 1, 2007 hi all.. can u help me with this.. i need to write a query of the form.. " SELECT SUM(X) FROM table WHERE MONTH = ( AN ARRAY WHOSE NUMBER OF ELEMENTS IS NOT KNOWN PRIOR.. IT IS DYNAMICALLY SLECTED FROM THE USER.. THRU INTERFACE )" plz suggest me sm wayz.. thank you.. cheerio.. sania.. Quote Link to comment Share on other sites More sharing options...
btherl Posted June 1, 2007 Share Posted June 1, 2007 $sep = ''; $sql = ' ( '; foreach ($array as $item) { $sql .= $sep . $item; } $sql .= ' ) '; I use this method quite often. Then you can use "WHERE MONTH IN $sql" If your months are string then you will need to escape and quote them. Quote Link to comment Share on other sites More sharing options...
sania Posted June 1, 2007 Author Share Posted June 1, 2007 thanku btherl.. it did help me.. thank a lot.. cheerio.. sania 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.