Ah ha! perfect! I wanted a way for SQL to handle this. DUH! Thanks John. -Matt On Thu, 2003-08-14 at 17:20, John W. Holmes wrote: > Matt Babineau wrote: > > Here is what I have for a layout: > > > > thing_id -> it is a hash value (md5()) > > > > I have a user session variable that is an array "thing_id's that were > > viewed". > > > > So each time the user click a like to view a thing_id, I note that in a > > session variable, so when they go back to the home page, all the things > > they have viewed are not shown, only the ones they have not viewed. > > > > Thing_id > > --------- > > 1 | hash_id_1 > > 2 | hash_id_2 > > 3 | hash_id_3 > > 4 | hash_id_4 > > > > Viewed (Session Var) > > -------------------- > > 1 | hash_id_2 > > 2 | hash_id_4 > > > > > > So when the user hits the homepage, they should get a list of 2 hash > > ID's hash_id_1 and hash_id_3. That is how I want this to work, I just > > need a slick way to compare and filter the viewed hash_id's from the > > complete list I am pulling form the DB. > > > > Does that help? > > Yes. You only need to maintain one list, actually, the list of "things" > that the user has viewed. Then, do something like this: > > $list = "'" . implode("','",$_SESSION['viewed_hash']) . "'"; > $query = "SELECT thing FROM Thing_Table WHERE thing_hash NOT IN ($list)"; > > Run that query and you'll have all of the results in the table that the > view has not seen. > > -- > ---John Holmes... > > Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ > > PHP|Architect: A magazine for PHP Professionals â www.phparch.com > > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php