global $mysqli; global $id; global $cid; $query = 'INSERT INTO ClassComment(CID, ID, Comment) VALUES (?,?,?)'; #$date = date('Y-m-d H:i:s'); $stmt = $mysqli->prepare($query); if (!$stmt) { echo "Prepare failed: (" . $mysqli->errno . ")" . $mysqli->error; } if (!$stmt->bind_param("iis", $cid, $id, $_GET['content'])) { echo "Binding parameters failed: (" . $stmt->errno . ") " . $stmt->error; } if (!$stmt->execute()) { echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error; } $stmt->close(); } if (!empty($_GET['content'])) { commentInsertion(); } if ($cid != NULL) { findDes(); findComment(); submitComment(); //>>>>>>> Update for COmment } $mysqli->close(); ?> </body> </html>
<?php include ("phpFunctions.php"); $commentPost = $_POST['commentpostid']; $commentContent = $_POST['commentcontent']; $commentByUsername = $_POST['commentbyusername']; if(checkEmptyAndNullString($commentContent) || checkEmptyAndNullString($commentByUsername)) { redirect("main.php"); } else { submitComment($commentContent, $commentByUsername, $commentPost); redirect("view_post.php?postid=$commentPost"); } ?>