PHP使用通配符下拉菜单过滤单词 [英] PHP drop down menu filter for a word using wildcards
问题描述
我正在建立个人电影数据库。我用我的照片,收视率,年份,yada yada从imdb中删除了我的信息。但我的过滤器需要一些调整/帮助。我只能在我的类型栏中过滤一个单词。
我希望能够显示包含单词Action的所有记录(即%Action%)。
现在它正在返回记录,其中列中唯一的单词是Action。
方式mysql列已设置,其中包含Action,Drama,Thriller或Comedy,Drama,Romance或Action,Adventure等数据。目前,我的过滤器正在跳过这些类型记录并返回那些只有动作的记录。
我希望找到一种方法来调整我的filters.php在我的过滤器表单中填写我的下拉菜单。我尝试了一些基本的调整来尝试允许任何带有单词Action的记录,或任何带有单词Drama的记录都无济于事:
行动 => %Action%,
行动=> *行动*,
等
这是我的filters.php页面。
I am building a personal movie database. I've scraped my info from imdb with my pictures, ratings, year, yada yada. But my filter needs some tweaking/help. I can only seem to filter one word in my genre column.
I want to be able to show all records that contain the word Action (i.e. %Action%).
Right now it's returning the records where the only word in the column is Action.
The way the mysql column is setup, it has data in it like "Action, Drama, Thriller" or "Comedy, Drama, Romance" or "Action, Adventure". Currently, my filter is skipping these genre records and returning the ones that have just "Action".
I was hoping to find a way to tweak my filters.php which fills up my drop down menu in my filter form. I've tried a bunch of basic tweaks to try and allow any record with the word Action, or any record with the word Drama to no avail:
"Action" => "%Action%",
"Action" => "*Action*",
etc.
Here is my filters.php page.
$genres = array(
"Action" => "Action",
"Adventure" => "Adventure",
"Animatin" => "Animatin",
"Biography" => "Biography",
"Comedy" => "Comedy",
"Crime" => "Crime",
"Documentary" => "Documentary",
"Drama" => "Drama",
"Family" => "Family",
"Fantasy" => "Fantasy",
"Fil-Noir" => "Fil-Noir",
"History" => "History",
"Horror" => "Horror",
"Music" => "Music",
"Musical" => "Musical",
"Mystery" => "Mystery",
"Romance" => "Romance",
"Sci-Fi" => "Sci-Fi",
"Sport" => "Sport",
"Thriller" => "Thriller",
"War" => "War",
"Western" => "Western");
任何帮助都会非常感激,因为这是我完成项目所需要做的最后一件事。
Jerome
Any help would be greatly appreciated as this is the last thing I need to do to complete the project.
Jerome
推荐答案
流派 =数组(
行动 => 操作,
冒险 => 冒险,
Animatin => Animatin,
传记 => 传记,
喜剧 => 喜剧,
犯罪 => 犯罪,
纪录片 => 纪录片,
戏剧 => 戏剧,
家庭 => Family,
幻想 => 幻想,
Fil-Noir => Fil-Noir,
历史记录 => 历史记录,
恐怖 => 恐怖,
音乐 => 音乐,
音乐剧 => 音乐,
神秘 => 神秘,
浪漫 => 浪漫,
Sci-Fi => Sci-Fi,
Sport => Sport,
惊悚片 => Thriller,
战争 => War,
Western => Western);
genres = array( "Action" => "Action", "Adventure" => "Adventure", "Animatin" => "Animatin", "Biography" => "Biography", "Comedy" => "Comedy", "Crime" => "Crime", "Documentary" => "Documentary", "Drama" => "Drama", "Family" => "Family", "Fantasy" => "Fantasy", "Fil-Noir" => "Fil-Noir", "History" => "History", "Horror" => "Horror", "Music" => "Music", "Musical" => "Musical", "Mystery" => "Mystery", "Romance" => "Romance", "Sci-Fi" => "Sci-Fi", "Sport" => "Sport", "Thriller" => "Thriller", "War" => "War", "Western" => "Western");
任何帮助都会非常感激,因为这是我完成项目所需要做的最后一件事。
Jerome
Any help would be greatly appreciated as this is the last thing I need to do to complete the project.
Jerome
这篇关于PHP使用通配符下拉菜单过滤单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!