Home  >  Article  >  php教程  >  PHP+MySQL在线答题功能

PHP+MySQL在线答题功能

WBOY
WBOYOriginal
2016-06-07 11:38:371466browse

本文给大家介绍如何使用jQuery+PHP+MySQL来实现在线测试题,包括动态读取题目,答题完毕后台评分,并返回答题结果。
PHP+MySQL在线答题功能
读取答题列表:$sql = "select * from quiz order by id asc"; <br> $query = mysql_query($sql); <br> while ($row = mysql_fetch_array($query)) { <br>     $answers = explode('###', $row['answer']); <br>     $arr[] = array( <br>         'question' => $row['id'] . '、' . $row['question'], <br>         'answers' => $answers <br>     ); <br> } <br> $json = json_encode($arr);我们在#quiz-container生成答题列表:<div></div>quiz插件调用:$(function(){  <br>     $('#quiz-container').jquizzy({  <br>         questions: <?php echo $json;?>, //试题信息  <br>         sendResultsURL: 'data.php' //结果处理地址  <br>     });  <br> });答题演示地址:http://www.sucaihuo.com/php/113.html

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn