| $host = ' localhost '; $user _name = ' root '; $password = ' admin '; $conn = mysql_connect ($host, $user _name, $password); if (! $conn) { Die (' Database connection failed: '. mysql_error ()); } mysql_select_db (' Test '); $sql = ' Select Id,name,city,created_time from users '; $result = mysql_query ($sql) or Die ("<br/>error: <b>". Mysql_error (). " </b><br/> problem-generating sql: ". $sql); ?> <title>13-12.php</title> <script language= "Web Effects" > </script> <center> <body> <table width= "75%" border= "0" cellpadding= "0" cellspacing= "1" bgcolor= "#7b7b84" > <tr bgcolor= "#8bbcc7" > <TD height= "><div" align= "center" ><strong> User id</strong></div></td> <td><div align= "center" ><strong> User name </strong></div></td> <td><div align= "center" ><strong> from City </strong></div></td> <td><div align= "Center" ><strong> Registration Time </strong></div></td> <td><div align= "Center" ><strong> Operations </strong></div></td> </tr> <?php if ($num = mysql_num_rows ($result)) { while ($row = Mysql_fetch_array ($result, MYSQL_ASSOC)) { ?> <tr bgcolor= "#ffffff" > <TD height= "align=" "right" ><?php echo $row [' id '];?> </td> <TD height= "> <?php" echo $row [' name '];?> </td> <TD height= "> <?php echo $row [' City '];?> </td> <TD height= "> <?php" echo $row [' created_time '];?> </td> <TD height= "> <a onclick=" javascript:if (' Determine to delete user information? ')) return true; else return false; "href=" 13-13.php?id=<?php echo $row [' id '];?> "> Delete </a> </td> </tr> <?php } } Mysql_close ($conn); ?> </table> </body> </center>
|