导航:首页 > 万维百科 > 网站投票系统数据库设计

网站投票系统数据库设计

发布时间:2020-10-17 00:35:20

1、我在用MYSQL+myeclipse做一个jsp的投票系统。但是现在不懂怎么设计数据库,有谁能帮帮忙?

有关投票的,具体的需求是什么,简单的只要两张表就可以了
投票结果(结果ID ,结果Name,结果count)
投票内容(投票人,投票id)
外加一张散列表记录用户,防止重复提交

2、投票系统的代码是怎么设计的??

<form action="c.asp" method="post">
<font color=#88ddff size=2>你对本站的印象如何:</font>
<p><font color=#ff0000 size=2>很好:<input type=radio name="ying" value="good">
一般:<input type=radio name="ying" value="yiban">
<p>差:<input type=radio name="ying" value="bad">
很差:<input type=radio name="ying" value="vbad"></font>
<p><center><input type=submit value="查看结果">
<P><input type=reset value="重新选择">
</center></form>
<%
ming=request.form("ying")
%>
<%
if ming="" then
%>
<%
elseif ming="good" then
countfile=Server.mappath("good.txt")
set fileinstance=Server.CreateObject("SCRIPTING.filesystemobject")
set textinstance=fileinstance.opentextfile(countfile,1,false,false)
ren1=textinstance.readall
ren1=ren1+1
set textinstance=fileinstance.createtextfile(countfile,true,false)
textinstance.writeline(ren1)
%>
很好:<%=ren1%>;
<%
countfile1=Server.mappath("yiban.txt")
set fileinstance=Server.CreateObject("SCRIPTING.filesystemobject")
set textinstance=fileinstance.opentextfile(countfile1,1,false,false)
ren2=textinstance.readall
%>
一般:<%=ren2%>;
<%
countfile1=Server.mappath("bad.txt")
set fileinstance=Server.CreateObject("SCRIPTING.filesystemobject")
set textinstance=fileinstance.opentextfile(countfile1,1,false,false)
ren3=textinstance.readall
%>
<P> 差:<%=ren3%>;
<%
countfile=Server.mappath("vbad.txt")
set fileinstance=Server.CreateObject("SCRIPTING.filesystemobject")
set textinstance=fileinstance.opentextfile(countfile,1,false,false)
ren4=textinstance.readall
%>
很差:<%=ren4%>;

<%
elseif ming="yiban" then
countfile=Server.mappath("good.txt")
set fileinstance=Server.CreateObject("SCRIPTING.filesystemobject")
set textinstance=fileinstance.opentextfile(countfile,1,false,false)
ren1=textinstance.readall

%>
很好:<%=ren1%>;
<%
countfile1=Server.mappath("yiban.txt")
set fileinstance=Server.CreateObject("SCRIPTING.filesystemobject")
set textinstance=fileinstance.opentextfile(countfile1,1,false,false)
ren2=textinstance.readall
ren2=ren2+1
set textinstance=fileinstance.createtextfile(countfile1,true,false)
textinstance.writeline(ren2)
%>
一般:<%=ren2%>;
<%
countfile1=Server.mappath("bad.txt")
set fileinstance=Server.CreateObject("SCRIPTING.filesystemobject")
set textinstance=fileinstance.opentextfile(countfile1,1,false,false)
ren3=textinstance.readall
%>
<P>差:<%=ren3%>;
<%
countfile=Server.mappath("vbad.txt")
set fileinstance=Server.CreateObject("SCRIPTING.filesystemobject")
set textinstance=fileinstance.opentextfile(countfile,1,false,false)
ren4=textinstance.readall
%>
很差:<%=ren4%>;

<%
elseif ming="bad" then
countfile=Server.mappath("good.txt")
set fileinstance=Server.CreateObject("SCRIPTING.filesystemobject")
set textinstance=fileinstance.opentextfile(countfile,1,false,false)
ren1=textinstance.readall

%>
很好:<%=ren1%>;
<%
countfile1=Server.mappath("yiban.txt")
set fileinstance=Server.CreateObject("SCRIPTING.filesystemobject")
set textinstance=fileinstance.opentextfile(countfile1,1,false,false)
ren2=textinstance.readall

%>
一般:<%=ren2%>;
<%
countfile1=Server.mappath("bad.txt")
set fileinstance=Server.CreateObject("SCRIPTING.filesystemobject")
set textinstance=fileinstance.opentextfile(countfile1,1,false,false)
ren3=textinstance.readall
ren3=ren3+1
set textinstance=fileinstance.createtextfile(countfile1,true,false)
textinstance.writeline(ren3)
%>
<P>差:<%=ren3%>;
<%
countfile=Server.mappath("vbad.txt")
set fileinstance=Server.CreateObject("SCRIPTING.filesystemobject")
set textinstance=fileinstance.opentextfile(countfile,1,false,false)
ren4=textinstance.readall
%>
很差:<%=ren4%>;

<%
elseif ming="vbad" then
countfile=Server.mappath("good.txt")
set fileinstance=Server.CreateObject("SCRIPTING.filesystemobject")
set textinstance=fileinstance.opentextfile(countfile,1,false,false)
ren1=textinstance.readall

%>
很好:<%=ren1%>;
<%
countfile1=Server.mappath("yiban.txt")
set fileinstance=Server.CreateObject("SCRIPTING.filesystemobject")
set textinstance=fileinstance.opentextfile(countfile1,1,false,false)
ren2=textinstance.readall

%>
一般:<%=ren2%>;
<%
countfile1=Server.mappath("bad.txt")
set fileinstance=Server.CreateObject("SCRIPTING.filesystemobject")
set textinstance=fileinstance.opentextfile(countfile1,1,false,false)
ren3=textinstance.readall

%>
<P> 差:<%=ren3%>;
<%
countfile=Server.mappath("vbad.txt")
set fileinstance=Server.CreateObject("SCRIPTING.filesystemobject")
set textinstance=fileinstance.opentextfile(countfile,1,false,false)
ren4=textinstance.readall
ren4=ren4+1
set textinstance=fileinstance.createtextfile(countfile1,true,false)
textinstance.writeline(ren4)
%>
很差:<%=ren4%>;
<%
end if
%>

3、建一个带有投票系统的网站,需要多大的网站空间?还有数据库用access还是sql的?

看你的数据量了,acc或者sql的都可以,我建过这样的网站,可以帮你!

4、网页制作 求救 需要用PHP写一个投票系统 结果放在mysql数据库中 能在本机显示就可以了

先设计表结构: 一个表用来记录投票的题目,一个表用来记录投票的人员、投哪一个标题、投的好评差评等。 由于这两个表属于多对多关系,再建一个关系表。总共3张表。 再进行程序设计: 1、一个人对同一个标题只能投一票。 2、程序能够统计该题目的所有投票人员及其评价等级。 最后优化数据库: 要是你只想能用就行,这步就别做了。 要是构建在大型网站上,要给表写存储过程、加索引。

满意请采纳

5、做一个网页投票系统,如何在不写、读数据库的情况下统计票数,然后将票数写入数据库?

不读取数据库,抄怎么写入数据库呢?这一点我很感兴趣。

可以先建立起脚本函数,在页面上统计,汇总后再存入数据库。但个人建议不如在数据库中建立起临时表,把数据存入。点击提交时把数据汇总追加到总表,点击取消时,删除数据不予追加。

6、如果一个投票系统,限制每个用户每个投票只能投一次,数据库结构怎么设计?

就你所提出的两种方案相比较第二种更合适。投票的目的是广泛采纳用户对问题的答案,所以是以有限的选择询问无限的对象。因此对象的数量会更大。你所说的1000个票现实不常见,但是10000个人却很平常。如果你的投票是有限的,比如一张试卷,即使选择题再多也是有数的,那么可以用一个表,字段为用户,答案。答案字段设计长度为题目数量,没有做过的题目就按0处理,做过的就按答案序号处理,如果查询是否做过也只是针对一个字段进行处理,会比较方便。我的表达可能不是很明白,希望你能谅解。

7、一个投票系统的数据库设计

这个,我的回到是sql server版本的 Oracle了解。。mysql不熟悉。。。

--用户信息表
create table userinfo(
uid int identity(1,1) primary key,
uname nvarchar(20) not null,
usex nvarchar(2) check (usex in ('男','女')),
imgpath nvarchar(500),--存放上传图片的路径,如果是多张图片的话可以用特殊符号隔开,
--在显示的时候可以用split方法,很多语言都有这个方法的
/*
自己加字段吧
*/
)
--用户登陆表
create table account(
id int identity(1,1) primary key,
account_name nvarchar(20) not null,
account_password nvarchar(64) not null,
uid references userinfo(uid)
)
--投票
/*
id 记录的主键
a-e 为评价的等级 没有投票的为0 投一票就加1
goods_id 为所评论对象id的外键关联
要投票的时候先判断表里有没有被评论对象的id
有就修改记录,没有就插入新纪录
这样的话用户的信息就没办法被录入到这张表中,但是在页面跳转的时候
用户信息是可以放在session里的,应该是没用影像的
如果以 用户id和被评论对象的id做组合主键的话
冗余数据就太多了
*/
create table acc_vote(
id int identity(1,1) primary key,
a int not null,
b int not null,
c int not null,
d int not null,
e int not null,
goods_id references goods_table_name(index)
)
--留言表
create table acc_leaveword(
id int identity(1,1) primary key,
title nvarchar(100),
author nvarchar(50),
publishtime nvarchar(20),
conntent nvarchar(20),
isrestore int,--是否为回复,是主题的话0,回复的话就自引用对应主题的id
id int references account(id)
)

8、网上投票系统 设计思路

这个网上实例很多,建议直接学习别人的经验。
主要是一个数据库的连接与计数问题。
如何保证同一个session内不能计数多次(一个会话只能投一次有效票),
如何保证同时投票的多人能够都投票成功,即多线程问题,或数据库临时锁定。

9、简单的投票系统(数据库OnlineVoteDB)课程设计怎么做?

问乐乐去她会告诉你的

与网站投票系统数据库设计相关的知识