From: "James Johnson" <[EMAIL PROTECTED]> > Actually, I'm using $campusList for a SQL statement: > > SELECT name FROM campuses WHERE inst_id IN ('$campusList'); > > It wasn't working until I found out that $campusList needs to look like > '1','2','3'. > > $campusList = implode( ', ', $_POST['campus'] ); > > Returns 4,2,3 (whatever was selected) > > I've looked in the manual on implode, but don't see how to surround each > value with single quotes. Is there another function that will do this?
You don't need the quotes if the values are integers, but if you insist... $campusList = "'" . implode("','",$_POST['campus']) . "'"; The implode "pattern" is a single quote, comma, single quote, then surround the whole implode result by single quotes to complete it. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php