<?php require_once 'StuService.class.php'; $name = $_GET['name']; $grade = $_GET['grade']; $email = $_GET['email']; $score = $_GET['score']; $stuService = new StuService(); $res = $stuService->adduser($name, $grade, $email, $score); echo $res;
<?php //show all the student echo "<meta http-equiv='content-type' content='text/html;charset=utf-8' />"; require_once 'StuService.class.php'; $pageNow = 1; $pageCount = 0; $rowCount = 0; $pageSize = 3; if ($_GET['pageNow'] > 1) { $pageNow = $_GET['pageNow']; } $stuService = new StuService(); $pageCount = $stuService->getPageCount($pageSize); $res2 = $stuService->getStuListByPage($pageNow, $pageSize); echo "<table border='1px' width='700px'>"; echo "<tr>\n <th>ID</td>\n <th>name</th>\n <th>grade</th>\n <th>email</th>\n <th>score</th>\n </tr>"; for ($i = 0; $i < count($res2); $i++) { $row = $res2[$i]; echo "<tr>\n <td>{$row['id']}</td>\n <td>{$row['name']}</td>\n <td>{$row['grade']}</td>\n <td>{$row['email']}</td>\n <td>{$row['score']}</td>\n <td><a href='#'>删除用户</a></td>\n <td><a href='#'>修改用户</a></td>\n\n </tr>"; } echo "<h1>student message</h1>"; echo "</table>"; $rowCount = $pageCount * $pageSize; ?> <form action="stuList.php"> <input type="text" name="pageNow" /> <input type="submit" value="go" /> </form> <?php