Advertisement
cdsatrian

user datagrid

Jul 26th, 2014
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1. <?php
  2. session_start();
  3. if(!isset($_SESSION['valid']))
  4.   header('Location: login.php');
  5. else{
  6.   include_once("config.php");
  7.   $result=mysql_query("SELECT id,name,age,email FROM users ORDER BY id DESC");
  8.   ?>
  9. <html>
  10. <title>Homepage</title>
  11. <body>
  12.   <a href='index.php'>Home</a> | <a href="add.html">Add New Data</a>
  13.   <br/><br/>
  14.   <table width='100%' border=0>
  15.     <tr bgcolor='#CCCCCC'>
  16.       <th>Name</th>
  17.       <th>Age</th>
  18.       <th>Email</th>
  19.       <th>Update</th>
  20.     </tr>
  21. <?php
  22.   while($res=mysql_fetch_assoc($result)){
  23.     echo "
  24.    <tr>
  25.      <td>".$res['name']."</td>
  26.      <td>".$res['age']."</td>
  27.      <td>".$res['email']."</td>
  28.      <td><a href='edit.php?id={$res['id']}'>Edit</a> | <a href='delete.php?id={$res['id']}'>Delete</a></td>
  29.    </tr>";
  30.   }
  31. }
  32. ?>
  33.   </table>
  34. </body>
  35. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement