您好,欢迎访问一九零五行业门户网

昨晚忙到凌晨3点都没解决的问题,大侠,今天晚能不熬夜不?HELP!

想做一个在线答题系统,看看网上有个现成的,拿来试试,下载源码上传到sina云,为什么和原创的不一样呢?(答完题后没分数)
我的sina云地址:http://1.xyqcsmwly.sinaapp.com/quizphp/quiz.php
原创的演示地址:http://www.helloweba.com/demo/quiz/quiz.php
我的代码:
quiz.php
$row['id'].'、'.$row['question'], 'answers' => $answers );}$json = json_encode($arr);?>演示:如何使用jquery+php+mysql来实现一个在线测试项目 helloweba
如何使用jquery+php+mysql来实现一个在线测试项目
powered by helloweba.com 允许转载、修改和使用本站的demo,但请注明出处:www.helloweba.com

connect.php

data.php


回复讨论(解决方案) data.php


quizs.js
(function($) { $.fn.jquizzy = function(settings) { var defaults = { questions: null, startimg: 'images/start.gif', endtext: '已结束!', shorturl: null, sendresultsurl: null, resultcomments: { perfect: '你是爱因斯坦么?', excellent: '非常优秀!', good: '很好,发挥不错!', average: '一般般了。', bad: '太可怜了!', poor: '好可怕啊!', worst: '悲痛欲绝!' } }; var config = $.extend(defaults, settings); if (config.questions === null) { $(this).html('failed to parse questions.
'); return; } var supercontainer = $(this), answers = [], introfob = ' 请认真完成测试题。准备好了吗?
', exitfob = '' + config.endtext + '
请选择一个选项!
', contentfob = '', questionsiteratorindex, answersiteratorindex; supercontainer.addclass('main-quiz-holder'); for (questionsiteratorindex = 0; questionsiteratorindex < config.questions.length; questionsiteratorindex++) { contentfob += '' + (questionsiteratorindex + 1) + '/' + config.questions.length + '
' + config.questions[questionsiteratorindex].question + '
'; for (answersiteratorindex = 0; answersiteratorindex 50) return config.resultcomments.average; else if (score > 35) return config.resultcomments.bad; else if (score > 20) return config.resultcomments.poor; else return config.resultcomments.worst; } progresskeeper.hide(); notice.hide(); slideslist.hide().first().fadein(500); supercontainer.find('li').click(function() { var thisli = $(this); if (thisli.hasclass('selected')) { thisli.removeclass('selected'); } else { thisli.parents('.answers').children('li').removeclass('selected'); thisli.addclass('selected'); } }); supercontainer.find('.nav-start').click(function() { $(this).parents('.slide-container').fadeout(500, function() { $(this).next().fadein(500); progresskeeper.fadein(500); }); return false; }); supercontainer.find('.next').click(function() { if ($(this).parents('.slide-container').find('li.selected').length === 0) { notice.fadein(300); return false; } notice.hide(); $(this).parents('.slide-container').fadeout(500, function() { $(this).next().fadein(500); }); progress.animate({ width: progress.width() + math.round(progresswidth / questionlength) }, 500); return false; }); supercontainer.find('.prev').click(function() { notice.hide(); $(this).parents('.slide-container').fadeout(500, function() { $(this).prev().fadein(500); }); progress.animate({ width: progress.width() - math.round(progresswidth / questionlength) }, 500); return false; }); supercontainer.find('.final').click(function() { if ($(this).parents('.slide-container').find('li.selected').length === 0) { notice.fadein(300); return false; } supercontainer.find('li.selected').each(function(index) { useranswers.push($(this).parents('.answers').children('li').index($(this).parents('.answers').find('li.selected')) + 1); }); progresskeeper.hide(); var resultset = ''; if (config.sendresultsurl !== null) { var collate = []; var myanswers = ''; for (r = 0; r < useranswers.length; r++) { collate.push('{questionnumber:' + parseint(r + 1, 10) + ', useranswer:' + useranswers[r] + '}'); myanswers = myanswers + useranswers[r]+'|'; } $.getjson(config.sendresultsurl,{an:myanswers},function(json){ if(json==null){ alert('通讯失败!'); }else{ var corects = json['res']; $.each(corects,function(index,array){ resultset += '' + (corects[index] === 1 ? #+(index + 1)+
: #+(index + 1)+
)+'
'; }); resultset = '' + judgeskills(json.score) + '
您的分数: ' + json.score + '
' + resultset + '
'; supercontainer.find('.result-keeper').html(resultset).show(500); } }); } //supercontainer.find('.resultsview-qhover').hide(); $(this).parents('.slide-container').fadeout(500, function() { $(this).next().fadein(500); }); return false; }); };})(jquery);
文件目录:
原创在线答题源码地址:http://www.helloweba.com/downsoft/297/
大侠们,帮忙看看,谢谢!
quiz.sql
-- phpmyadmin sql dump-- version 3.2.0.1-- http://www.phpmyadmin.net---- 主机: localhost-- 生成日期: 2015 年 04 月 04 日 13:49-- 服务器版本: 5.5.8-- php 版本: 5.3.3set sql_mode=no_auto_value_on_zero;/*!40101 set @old_character_set_client=@@character_set_client */;/*!40101 set @old_character_set_results=@@character_set_results */;/*!40101 set @old_collation_connection=@@collation_connection */;/*!40101 set names utf8 */;---- 数据库: `lrfbeyond_demo`---- ------------------------------------------------------------ 表的结构 `quiz`--create table if not exists `quiz` ( `id` int(11) not null auto_increment, `question` varchar(100) not null, `answer` varchar(500) not null, `correct` tinyint(2) not null, primary key (`id`)) engine=myisam default charset=utf8 auto_increment=6 ;---- 转存表中的数据 `quiz`--insert into `quiz` (`id`, `question`, `answer`, `correct`) values(1, '罗马帝国曾一度辉煌,令人神往,故有“条条大陆通罗马”一说。那么,今天你是怎样理解这一谚语的准确含义的?', 'a.入乡随俗 ###b.四通八达 ###c.殊途同归 ###d.流连忘返', 3),(2, '找出不同类的一项:', 'a.斑马 ###b.军马 ###c.赛马 ###d.骏马 ###e.驸马', 5),(3, ' 蜡烛在空气中燃烧,蜡烛质量逐渐变小。这说明', 'a.物质可以自生自灭###b.发生的不是化学变化###c.不遵守质量守恒定律###d.生成物为气体,散发到空气中了', 4),(4, '以下哪位歌手没有获得过《我是歌手》总冠军?', 'a.羽泉###b.韩磊###c.邓紫棋###d.韩红', 3),(5, '下列哪个标签不是html5中的新标签?', 'a.<article>###b.<canvas>###c.<section>###d.<sub>', 4);
感谢版主大人xuzuning的回复,补齐4个文件,仍不能统计出结果。
补齐4个文件后的测试连接:http://2.xyqcsmwly.sinaapp.com/quiz.php
warning: cannot modify header information - headers already sent by (output started at /data1/www/htdocs/795/xyqcsmwly/2/quiz.php:1) in connect.php on line 12
你自己 f12
感谢,xuzuning,程序已正常运行。估计和sina云身份认证有关,谢谢!
其它类似信息

推荐信息