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.. Link to comment https://forums.phpfreaks.com/topic/53825-help-me-please/ 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. Link to comment https://forums.phpfreaks.com/topic/53825-help-me-please/#findComment-266081 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 Link to comment https://forums.phpfreaks.com/topic/53825-help-me-please/#findComment-266087 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.