php
1 <html> 2 <body> 3 4 <?php 5 $con = mysql_connect("localhost","root",""); 6 if (!$con) 7 { 8 die('Could not connect: ' . mysql_error()); 9 } 10 11 mysql_select_db("faketaobao", $con); 12 $id = $_GET["id"]; 13 $result = mysql_query("SELECT id,username FROM accounts WHERE id = $id"); 14 15 echo "<table border='1'> 16 <tr> 17 <th>Id NO.</th> 18 <th>UserName</th> 19 </tr>"; 20 21 while($row = mysql_fetch_array($result)) 22 { 23 echo "<tr>"; 24 echo "<td>" . $row['id'] . "</td>"; 25 echo "<td>" . $row['username'] . "</td>"; 26 echo "</tr>"; 27 } 28 echo "</table>"; 29 echo mysql_errno() . ": " . mysql_error(). "\n"; 30 mysql_close($con); 31 ?> 32 </body> 33 </html> 34 </html>