briant Posted August 28, 2008 Share Posted August 28, 2008 Hello everyone. OK, I know storing imploded arrays in a database field isn't the best technique but I think it's more organized. Well, I'm working on a movies database that consist of Actors field listing all the actors for that movie. They are separated by a simple comma. For ie: Will Smith, Charlize Theron, Jason Bateman, Jae Head. I would like to list all the movies an actor has appeared in using SELECT. Normally, I would use a wildcard *Will Smith* but if another actor was *Smith*... that method wouldn't work. Is there a way to make a field explode into an array then search it using SELECT? Hope someone understands what I'm trying to accomplish. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/121657-search-arrays-in-database/ Share on other sites More sharing options...
bluejay002 Posted August 28, 2008 Share Posted August 28, 2008 if you want to be specific with will smith, you can use %will smith% instead. i think that would suffice, unless you specifically stated there %smith% it will display all other patterns that match to it. Quote Link to comment https://forums.phpfreaks.com/topic/121657-search-arrays-in-database/#findComment-627625 Share on other sites More sharing options...
briant Posted August 28, 2008 Author Share Posted August 28, 2008 Hello bluejay002, Thanks for your reply. I meant to put % as the wildcard instead of *. But I wanted to find an exact array value instead of partial. Wildcards won't help. Quote Link to comment https://forums.phpfreaks.com/topic/121657-search-arrays-in-database/#findComment-627626 Share on other sites More sharing options...
sasa Posted August 28, 2008 Share Posted August 28, 2008 look http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_find-in-set Quote Link to comment https://forums.phpfreaks.com/topic/121657-search-arrays-in-database/#findComment-627637 Share on other sites More sharing options...
briant Posted August 28, 2008 Author Share Posted August 28, 2008 I LOVE YOU Sasa. You helped me before. I think that's exactly what I am looking for thanks so much. Quote Link to comment https://forums.phpfreaks.com/topic/121657-search-arrays-in-database/#findComment-627640 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.