cstegner Posted May 17, 2006 Share Posted May 17, 2006 I need a query that will in essence be saying NOT IN ('$id_array') how do I do that? Quote Link to comment https://forums.phpfreaks.com/topic/9857-whats-the-opposite-of-id-in-id-array/ Share on other sites More sharing options...
.josh Posted May 17, 2006 Share Posted May 17, 2006 by saying NOT IN Quote Link to comment https://forums.phpfreaks.com/topic/9857-whats-the-opposite-of-id-in-id-array/#findComment-36607 Share on other sites More sharing options...
cstegner Posted May 17, 2006 Author Share Posted May 17, 2006 Crayon violet, you seem to always get the honors of making me feel like an idiot ;) Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/9857-whats-the-opposite-of-id-in-id-array/#findComment-36612 Share on other sites More sharing options...
obsidian Posted May 17, 2006 Share Posted May 17, 2006 [!--quoteo(post=374657:date=May 17 2006, 10:27 AM:name=cstegner)--][div class=\'quotetop\']QUOTE(cstegner @ May 17 2006, 10:27 AM) [snapback]374657[/snapback][/div][div class=\'quotemain\'][!--quotec--]I need a query that will in essence be saying NOT IN ('$id_array') how do I do that?[/quote]if you have an array in a variable, just implode it with the quotes you need and stick it right into your query:[code]<?php$array = array("blue", "green", "violet");$sql = mysql_query("SELECT * FROM tableName WHERE color NOT IN ('" . implode("', '", $array) . "')");?>[/code]good luck! Quote Link to comment https://forums.phpfreaks.com/topic/9857-whats-the-opposite-of-id-in-id-array/#findComment-36618 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.