在mysql数据库上创建图像幻灯片

在mysql数据库上创建图像幻灯片,mysql,Mysql,我的数据库中有一个表映像,可以存储一个产品的四个映像。我希望当用户搜索特定产品时,使用该产品的相应图像id为该产品生成图像幻灯片。谢谢 $sql5="create table if not exists product( prdid int(10) not null auto_increment primary key, type enum('house','car') not null, p_date timestamp not null DEFAULT CURRENT_TIMESTAMP,

我的数据库中有一个表映像,可以存储一个产品的四个映像。我希望当用户搜索特定产品时,使用该产品的相应图像id为该产品生成图像幻灯片。谢谢

$sql5="create table if not exists product(
prdid int(10) not null auto_increment primary key,
type enum('house','car') not null,
p_date timestamp not null DEFAULT CURRENT_TIMESTAMP,
amount varchar(15) not null,
description varchar(255) not null,
status enum('1','0') not null default '0',
prdfk int(10) not null,
foreign key(prdfk) references users(usid) on delete cascade
)DEFAULT CHARACTER SET utf8 ENGINE=InnoDB";


$sql6="create table if not exists images(
imgid int(10) not null auto_increment primary key,
name varchar(50) not null,
mimetype varchar(55) not null,
fielddata mediumblob not null,
imgfk int(10) not null,
foreign key(imgfk) references product(prdid) on delete cascade
)DEFAULT CHARACTER SET utf8 ENGINE=InnoDB";
这应该起作用:

select fielddate, mimetype, name from image join prduct on imgfk = prdid where prdi=<your productid>

你能更具体地说明什么不适合你吗?@AndriusNaruševičius,他希望搜索他的产品,并将这些产品的图像放在一个图像滑块中……当然,没有显示他的滑块代码-以为我们会为他编码。@mwas:你只需要sql来获取图像吗?@jens yeh…我不介意,即使它是sql。谢谢