选择下拉类别后,如何在下面的mysql表中显示图像 [英] How to display images from mysql table at below after selection of dropdown category

查看:57
本文介绍了选择下拉类别后,如何在下面的mysql表中显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在大多数在线购物网站上显示基于类别的网页图片的购物项目。我创建了两个mysql表:Ist,id,category_name,2nd,id,category_name,product,image_path。我能够在页面上一次显示所有产品图像,但我不知道如何显示从页面顶部的提交按钮下拉列表中选择的单个类别的产品图像。我希望我的观点清楚,否则我可以随意问我。


下面我附上我的代码,一次显示我的php页面上的所有产品图片,没有任何下拉列表。关于这样做的任何想法和建议都是受欢迎的。

展开 | 选择 | Wrap | 行号

解决方案

这是product.php页面的代码,其中从数据库中填充下拉列表:

展开 | 选择 | Wrap | 行号


执行与显示所有图像相同的操作,但包含WHERE子句以筛选要显示的类别。


< blockquote>你能详细说一下吗?我有两个数据库表。一个具有id,类别名称,另一个具有id,类别id,图像路径。


I want to show a category based shopping items with images on web page that can be found in the most Online shopping sites.I crated two mysql tables: Ist with id, category_name and 2nd with id, category_name, product, image_path. I am able to display all product images at a time on page, but I don''t know how to show product images of a single category selected from a dropdown list with submit button at the top of the page. I hope my point is clear to all otherwise feel free to ask me.

Below I attached my code that shows all the product images on my php page at a time without any dropdown list. Any ideas and advice on doing this is welcome.

Expand|Select|Wrap|Line Numbers

解决方案

Here is the code for product.php page where a dropdown list is populated from database:

Expand|Select|Wrap|Line Numbers


Do the same thing you did to display all the images, except include a WHERE clause to filter for the category you want to display.


Can you elaborate a little please? I have two database tables. One with id, category name and another with id, category id, image path.


这篇关于选择下拉类别后,如何在下面的mysql表中显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆