Advertisement
kiddie159

Untitled

Apr 14th, 2013
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. <?php
  2. $con=mysqli_connect("localhost","nextseal_new","plokij0987","nextseal_new");
  3. if (mysqli_connect_errno()){
  4. echo "connecting failed".mysql_connect_error();
  5. }
  6. ?>
  7. <html>
  8. <body><center>
  9. <form method="post">
  10. <input type="submit" name="show" value="show members">
  11. </form>
  12. <form method="post">
  13. Type only first name:<input type="text" name="del">
  14. <input type="submit" name="delete" value="delete members">
  15. </form>
  16. <form method="post">
  17. <input type="text" name="namemain"><br>
  18. <input type="text" name="fname"><br>
  19. <input type="text" name="lname"><br>
  20. <input type="text" name="addr"><br>
  21. <input type="text" name="phone"><br>
  22. <input type="submit" name="editm" value="add memeber">
  23. </form>
  24. <?
  25.  
  26. if (isset($_POST['editm']))
  27. {
  28. $sql="INSERT INTO persons(name, Firstname, Lastname, address, phone) VALUES('$_POST[namemain]','$_POST[fname]','$_POST[lname]','$_POST[addr]','$_POST[phone]')";
  29. if (mysqli_query($con,$sql))
  30. {
  31. echo "Values Addess Successfully !";
  32. }
  33. else {
  34. echo "Value Couldn't add".mysql_error();
  35. }
  36. mysqli_close($con);
  37. }
  38.  
  39. ?>
  40. <?php
  41. if (isset($_POST['show']))
  42. {
  43. $show="SELECT *FROM persons";
  44. $result=mysqli_query($con,$show);
  45. echo "<table border=1>";
  46. echo "<tr>";
  47. echo "<td>name</td><td>Firstname</td><td>Lastname</td><td>address</td><td>phone</td>";
  48. echo "</tr>";
  49. while ($row=mysqli_fetch_array($result))
  50. {
  51. echo "<tr>";
  52. echo "<td>".$row[0]."</td>";
  53. echo "<td>".$row[1]."</td>";
  54. echo "<td>".$row[2]."</td>";
  55. echo "<td>".$row[3]."</td>";
  56. echo "<td>".$row[4]."</td>";
  57. echo "</tr>";
  58. }
  59. echo "</table>";
  60. mysqli_close($con);
  61. }
  62. ?>
  63. <?php
  64. if (isset($_POST['del']))
  65. {
  66. $loilam=$_POST['del'];
  67. $del="DELETE FROM persons WHERE Firstname='$_POST[del]'";
  68. mysqli_query($con,$del);
  69. echo "member delete !";
  70. }
  71. ?>
  72. </cente
  73. </body>
  74. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement