dharm Posted May 7, 2007 Share Posted May 7, 2007 Hi, im having some trouble with this bit of code. im sure its an easy fix but i cnt seem to put my finger on it. $catline = "222,223,224,225,"; WHERE cat IN ('".substr(str_replace(",","','", $catline),0,-3)."') Any suggestions will be much appreciated. thx! Link to comment https://forums.phpfreaks.com/topic/50382-mysql-in-clause-with-php/ Share on other sites More sharing options...
boo_lolly Posted May 7, 2007 Share Posted May 7, 2007 use explode() Link to comment https://forums.phpfreaks.com/topic/50382-mysql-in-clause-with-php/#findComment-247411 Share on other sites More sharing options...
Barand Posted May 7, 2007 Share Posted May 7, 2007 <?php $catline = "222,223,224,225,"; // lose last comma $catline = trim($catline,','); echo "WHERE cat IN ($catline)"; ?> Link to comment https://forums.phpfreaks.com/topic/50382-mysql-in-clause-with-php/#findComment-247499 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.