List:General Discussion« Previous MessageNext Message »
From:T.J. Mahaffey Date:October 8 2005 11:09pm
Subject:Select values based on array containment?
View as plain text  
I'm working on a PHP script which will already have gathered a large  
array of string values from a text file. These values will correspond  
to item numbers in a MySQL table. What I need to do is select rows in  
the table based on whether or not their "item_number" values are in  
the pre-existing PHP array. (The idea here is that the website's  
inventory comes in as a text file. I need to compare that inventory  
with the items contained within the table and disable the catalog  
items which are not in current inventory.)

Something like this (obviously not real code, just an illustration of  
what I'm trying to get):

SELECT * in $mytable WHERE in_array('item_number',  
$arrayfromtextfile) = true

Of course, in_array() is a PHP function, but I'm hoping there is  
something similar available in MySQL.
Is this possible?
Thanks in advance for any insight someone might provide.

--
T.J. Mahaffey
tj@stripped



Thread
Select values based on array containment?T.J. Mahaffey9 Oct
  • Re: Select values based on array containment?SGreen10 Oct
  • Re: Select values based on array containment?Gleb Paharenko10 Oct
    • Re: Select values based on array containment?SGreen10 Oct
      • Re: Select values based on array containment?T.J. Mahaffey10 Oct