Advertisement
Guest User

Untitled

a guest
Apr 15th, 2014
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. <?php
  2. $con=mysqli_connect("localhost","root","admin","forum");
  3. if (mysqli_connect_errno())
  4. {
  5. echo "Failed to connect to MySQL: " . mysqli_connect_error();
  6. }
  7.  
  8. $post_id = $_POST['post_id'];
  9. $query = "SELECT * FROM post WHERE post_id ='".$post_id."'";
  10. $result = mysqli_query($con,$query);
  11. $rows = mysqli_fetch_array($result);
  12. ?>
  13. <table width="710" border="0" align="center" cellpadding="0" cellspacing="1">
  14. <tr>
  15. <td width="708"><form name="comment_insert" method="post" action="forum_comment_add_go.php">
  16. <table width="398" border="0" align="center">
  17. <tr>
  18. <th width="24" scope="col">NO</th>
  19. <th width="90" scope="col">DATE</th>
  20. <th width="68" scope="col">TIME</th>
  21. <th width="198" scope="col">COMMENT</th>
  22. </tr>
  23. <tr>
  24. <td>&nbsp;</td>
  25. <td><input name="date" type="text" id="date" size="15" /></td>
  26. <td><input name="time" type="text" id="time" size="10" maxlength="9" /></td>
  27. <td><input type="text" name="thread_comment" id="thread_comment" /></td>
  28. </tr>
  29. <tr>
  30. <td colspan="4" align="right"><?php echo "<input type='hidden' value='" . $rows['post_id'] . "' name='post_id'>"; echo "<input type='submit' value='Add Record'>";?></td>
  31. </tr>
  32. </table>
  33.  
  34.  
  35. </form>
  36. </td>
  37. </tr>
  38. </table>
  39. <?php
  40. mysqli_close($con);
  41. ?>
  42.  
  43. <script type="text/javascript">
  44. function CloseWindow() {
  45. window.close();
  46. window.opener.location.reload();
  47. }
  48. </script>
  49.  
  50. <?php
  51. error_reporting(E_ALL);
  52. ini_set('display_errors','on');
  53.  
  54. $con=mysqli_connect("localhost","root","admin","forum");
  55.  
  56. if (mysqli_connect_errno())
  57. {
  58. echo "Failed to connect to MySQL: " . mysqli_connect_error();
  59. }
  60. $date = $_POST['date'];
  61. $time = $_POST['time'];
  62. $thread_comment = $_POST['thread_comment'];
  63. $post_id = $_POST['post_id'];
  64. $comment_in="INSERT INTO comment ( date, time, thread_comment, post_id) VALUES ( '$date', '$time', '$thread_comment', '$post_id)";
  65. $result=mysqli_query($con, $comment_in);
  66.  
  67. if($result){
  68. echo "Successful";
  69. echo "<BR>";
  70. echo "<th><form>";
  71. echo "<input type='button' onClick='CloseWindow()' value='Done' align='middle'>";
  72. echo "</form></th>";
  73. }
  74. else {
  75. echo "Error";
  76. }
  77. mysqli_close($con);
  78. ?>
  79.  
  80. $comment_in="INSERT INTO comment ( date, time, thread_comment) VALUES ( $'date', $'time', $'thread_comment')";
  81.  
  82. $comment_in="INSERT INTO comment ( date, time, thread_comment) VALUES ( '$date', '$time', '$thread_comment')";
  83.  
  84. $date = $_POST['date'];
  85. $time = $_POST['time'];
  86. $thread_comment = $_POST['thread_comment'];
  87. $post_id = $_POST['post_id'];
  88. $comment_in="INSERT INTO comment ( date, time, thread_comment, post_id) VALUES ( '$date', '$time', '$thread_comment', '$post_id)";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement