masokis

QUERY DATA

Mar 16th, 2011
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.48 KB | None | 0 0
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  5. <title>*~~~~mY FrIeNsTeR~~~~~*</title>
  6. </head>
  7. <body>
  8. <?php
  9. $con = mysql_connect("localhost","root","");
  10. if (!$con)
  11.   {
  12.   die('Could not connect: ' . mysql_error());
  13.   }
  14.  
  15. mysql_select_db("personal", $con);
  16.  
  17. $result = mysql_query("SELECT * FROM friends");
  18. ?>
  19. <table width="923" border="1">
  20.   <tr>
  21.     <td width="32"><strong>ID</strong></td>
  22.     <td width="216"><strong>NAME</strong></td>
  23.     <td width="171"><strong>ADDRESS</strong></td>
  24.     <td width="117"><strong>PHONE NO. </strong></td>
  25.     <td width="176"><strong>EMAIL ADDRESS </strong></td>
  26.     <td width="136"><strong>WEB ADDRESS </strong></td>
  27.     <td width="45"></td>
  28.   </tr>
  29.  
  30.    
  31. <?php
  32. while($row = mysql_fetch_array($result))
  33.   {
  34.   echo "<tr>";
  35.   echo "<td align='center'>".$row['id']."</td>";
  36.   echo "<td>".$row['name']."</td>";
  37.   echo "<td>".$row['address']."</td>";
  38.   echo "<td>".$row['phone']."</td>";
  39.   echo "<td>". $row['email']."</td>";
  40.   echo "<td>". $row['web']."</td>";
  41.   echo "<td><p><a href='edit.php?id=$row[id]'>edit</a></p><p><a href='delete.php?id=$row[id]'>delete</a></p></td>";
  42.  
  43.  
  44.   echo "</tr>";
  45.   echo "<br />";
  46.   }
  47.  
  48. mysql_close($con);
  49. ?>
  50.  
  51.   </tr>
  52. </table>
  53. <br><br><br>
  54. <center><a href="index.html"><input name="ADD" type="button" value="ADD NEW FRIEND"></a></center>
  55.  
  56. </body>
  57. </html>
Advertisement
Add Comment
Please, Sign In to add comment