You left one out.I'm sure you are aware that this is a non-normalized database design, and that those tend to make designing queries more difficult and/or inefficient.
The LIKE operator should give you what you want, but you need to be careful:
(PHP string def:)
$sSQL = "SELECT <list> FROM <table> WHERE readBy LIKE '$UserID,%' OR readBy LIKE '%,$UserID' OR readBy LIKE '%,$UserID,%'"
You need to look for the three situations to avoid matching the wrong
entries in for example (11,20) (5,11) or (5,11,20).
OR readby = '$UserID'
to cover the case where there's only one reader. Other than that, I agree.
Bruce Feist
--------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php