全文链接:tecdat.cn/?p=29678

Requirement

Prior to beginning tis assignment, please download the studentsdb.sql, studentdb.pdf and the Index.php file from the course web site.
In this assignment, you are to complete the php script, Index.php, which will use the values input by the user. This script contains one push botton and one textbox in order to perform the interaction.
The web page should provide the following functions:

  1. Connect to the database
  2. Check if the database connection is successful
  3. Validation on user typing
  4. Search and display the query result of each student
  5. Error message if no student found

Analysis

本题需要实现一个简易的基于网页的查询功能,包括连接数据库、数据库查询、处理用户输入、异常处理。用户的交互部分已经由Index.php提供,我们需要做的是完善它的逻辑。
本题难点在于调试部分,建议一边实现一边调试,并在关键地方打印变量值来进行调试。

Tips

下面给出数据库连接部分代码,默认数据库为本地mysql,用户名为root,密码为123456

<?php
...
$conn = mysql_connect("localhost", "root", "123456");
if (!$conn) {
  // connection failed
  echo "Could not connect to database: " . mysql_error();
}
// connection successful
...
mysql_close($conn)
?>
复制代码

原文地址:http://www.cnblogs.com/tecdat/p/16829514.html

1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长! 2. 分享目的仅供大家学习和交流,请务用于商业用途! 3. 如果你也有好源码或者教程,可以到用户中心发布,分享有积分奖励和额外收入! 4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解! 5. 如有链接无法下载、失效或广告,请联系管理员处理! 6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需! 7. 如遇到加密压缩包,默认解压密码为"gltf",如遇到无法解压的请联系管理员! 8. 因为资源和程序源码均为可复制品,所以不支持任何理由的退款兑现,请斟酌后支付下载 声明:如果标题没有注明"已测试"或者"测试可用"等字样的资源源码均未经过站长测试.特别注意没有标注的源码不保证任何可用性