Hello, I was wondering if its possible to determine inside the SELECT function if an entry exists inside the table, Say I had a row named oID and inside that row there would be this data: 57,81,90,45,108 Now, what I want to do is select the results from a query that do not include the ID $id1 where $id1 = 81 Is this possible to do inside only the select statement? If not, what would be your suggestion. Thanks
Ok cool, the ! mark makes it select everything that doesn't include the $id1 ? Edit: I am using a code similar to below: $array = split(",", "$ids"); $complete = "false"; $fid = $rowsSet['fid']; foreach($array as $key => $value) { if (trim($value) == $fid){ $complete = "true"; } } Code (markup): And was wondering if I would be able to use to select function aswell as this combined to be able to pick out all the id's that are inside the database and display the ones that arent. The variable $ids would contain things such as.. 7632,734232,123565,237834,23546 etc.
Crayz, yes the exclamation does indeed mean "does not equal". You can also use the SELECT query inside of your foreach loop to determine if an ID exists in the database table... here is a quick example: <?php foreach($array as $key => $value) { $query="SELECT * FROM tablename WHERE oid = '".trim($value)."'"; $result=mysql_query($query); // Check the result if (mysql_num_rows($result)>0) { echo "The ID is in the table"; }else { echo "The ID is NOT in the table"; } } ?> Code (markup): HTH